sybase

Sybase Error Implicit Conversion from datatype 'VARCHAR' to 'INT' not allowed

偶尔善良 提交于 2019-12-12 16:16:56
问题 I'm getting this error when trying to run a query in my application and I'm not sure why: Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed. Use the CONVERT function to run this query. at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase

Sybase SQL Select Distinct Based on Multiple Columns with an ID

≯℡__Kan透↙ 提交于 2019-12-12 15:36:02
问题 I'm trying to query a sybase server to get examples of different types of data we hold for testing purposes. I have a table that looks like the below (abstracted) Animals table: id | type | breed | name ------------------------------------ 1 | dog | german shepard | Bernie 2 | dog | german shepard | James 3 | dog | husky | Laura 4 | cat | british blue | Mr Fluffles 5 | cat | other | Laserchild 6 | cat | british blue | Sleepy head 7 | fish | goldfish | Goldie As I mentioned I want an example

Incorrect syntax near the keyword table when I declare a table variable

北战南征 提交于 2019-12-12 13:17:36
问题 I am using Sybase database ISQL.exe. when I declare a table variable using this clause: declare @tabVar table (fid int, name varchar(10)) I got error: could not execute statement. Incorrect syntax near the keyword 'table' I don't see where is wrong, could any one help? 回答1: It's not correct construction. You can't use table type variable in sybase. For this solution I suggest to use temporary table as below: create table #tabVar ( fid int, name varchar(10) ) 回答2: This must be new in Sybase; I

Taking the “transpose” of a table using SQL

ぐ巨炮叔叔 提交于 2019-12-12 12:26:36
问题 I don't know if there is a name for this operation but it's similar to the transpose in linear algebra. Is there a way to turn an 1 by n table T1 such as c_1|c_2|c_3|...|a_n ------------------- 1 |2 |3 |...|n Into a n by 2 table like the following key|val ------- c_1|1 b_2|2 c_3|3 . |. . |. a_n|n I am assuming that each column c_i in T1 can be unlikely identified. 回答1: Basically, you need to UNPIVOT this data, you can perform this using a UNION ALL : select 'c_1' col, c_1 value from yourtable

How can I “merge”, “flatten” or “pivot” results from a query which returns multiple rows into a single result?

爱⌒轻易说出口 提交于 2019-12-12 10:35:39
问题 I have a simple query over a table, which returns results like the following: id id_type id_ref 2702 5 31 2702 16 14 2702 17 3 2702 40 1 2703 23 4 2703 23 5 2703 34 6 2704 1 14 And I would like to merge the results into a single row, for instance: id concatenation 2702 5,16,17,40:31,14,3,1 2703 23,23,34:4,5,6 2704 1:14 Is there any way to do this within a trigger? NB: I know I can use a cursor, but I would really prefer not to unless there is no better way. The database is Sybase version 12.5

PHP7 - Connect to sybase database

天大地大妈咪最大 提交于 2019-12-12 09:58:44
问题 http://php.net/manual/en/function.sybase-connect.php is removed as from PHP7. So now I am gettings this error: PHP Fatal error: Uncaught Error: Call to undefined function sybase_connect() How am I supposed to connect to sybase now with PHP7? 回答1: You are using Ubuntu 16.04, so after installation of php7.0-sybase package in your system, you are able to connect with Sybase database using pdo_dblib Example #1 PDO_DBLIB DSN examples sybase:host=localhost;dbname=testdb Following general PDO

Autonomous transactions in Sybase ASE 15.5

主宰稳场 提交于 2019-12-12 06:57:01
问题 I'm working on Oracle to Sybase ASE SPs conversion and trapped into the autonomous transaction usage in PL/SQL. Could you please let me know if there is any equivalent for this feature in Sybase Adaptive Server Enterprise? May be there are some relevant posts with the description of the solution for this problem? Thank you in advance. 回答1: Never mind. I've managed to find the solution myself. To whom it may be interested: The idea of the solution has been taken from the SQL Server external

Query for summation up to certain rows in a table

天涯浪子 提交于 2019-12-12 05:43:30
问题 I have a query like: select CONVERT(VARCHAR(7),[startdatetime],111) AS [year-month], nm.nameLine1, sum(datediff(hour, startdatetime, enddatetime)) as total from srl inner join sr on srl= sr.ServiceRequestId inner join Name nm on(sr.clientCustomerId = nm.customerId and nm.nameTypeId = 'OFICE') where (startdatetime >= '08-01-2011 00:00:00.000' and enddatetime <= '10-31-2011 00:00:00.000') group by nm.nameLine1, [year-month] order by nm.nameLine1, [year-month] output of the above query is:: year

Sybase 15.7 on Red Hat Enterprise Linux Server release 6.4 (Santiago)

梦想的初衷 提交于 2019-12-12 04:40:35
问题 I am migrating to Red Hat from Solaris. Previously on Solaris, we connected to Sybase datasources through Java by passing an interfaces file location to a JDBC library. When I checked the Sybase documentation, they only list interfaces files as an option for UNIX and Windows... Does anyone know what the equivalent is for Linux? I know our datasources have been transfered over, because when i connect with: isql -S <server> -U <user> -P <password> I can connect to the database. Unfortunately

Escape double quote in sybase

守給你的承諾、 提交于 2019-12-12 03:56:46
问题 I am running a query on a database to retrieve records in a CSV (with quotes) format: "Data","More data","some "funny" data with quotes","more" . Now when this is parsed, there is an obvious problem with this bit: ...,"some "funny" data with quotes",... Is there a way to "escape" these quotes in sybase to save me post-processing? 回答1: if it's just double-quote you want to select in a literal string, use single quote as the string's delimiter. Try select '"' and you'll see 回答2: --after you