sybase-ase

Is combining (result sets) of “two queries with aggregate and group by” possible?

会有一股神秘感。 提交于 2019-12-07 18:58:07
问题 1 Select id,count(*) as totalX FROM my_table WHERE x_factor = 1 GROUP BY id ResultSet : id totalX --------- -------------- 9 34 10 6 11 21 12 3 2 Select id,count(*) as totalY FROM my_table WHERE y_factor = 1 GROUP BY id ResultSet 2: id totalY --------- -------------- 9 334 10 56 11 251 12 93 Is there a way I can achieve this: id totalX totalY --------- -------------- -------------- 9 34 334 10 6 56 11 21 251 12 3 93 I would like the solution for Sybase 12.5 on RHEL 5, also I would like to

Calling Sybase Adaptive Server Enterprise's “sp_help” from JDBC

筅森魡賤 提交于 2019-12-07 13:06:44
问题 In order to query the database meta data in Sybase ASE, I found this relevant answer (not the accepted one), to be ideal: From a Sybase Database, how I can get table description ( field names and types)? Unfortunately, I can't seem to find any documentation, how I'm supposed to call sp_help from JDBC. According to the documentation, sp_help returns several cursors / result sets. The first one contains information about the table itself, the second one about the columns, etc. When I do this:

Is there any function like REPLACE?

笑着哭i 提交于 2019-12-07 07:13:20
问题 Is there any function to replace words in ASE? 回答1: Try this: SELECT str_replace( 'impossible', 'im',':)' ) 回答2: select str_replace(original,search,replacement) ASE does not have 'REPLACE' but 'str_replace' This will return varchar(LONG), you may have use cast to shrink it back down. 回答3: REPLACE ( original-string, search-string, replace-string ) SELECT REPLACE( 'abc,def,ghi,jkl', 'abc', 'xx' ) FROM products 来源: https://stackoverflow.com/questions/6547383/is-there-any-function-like-replace

DBUnit Sybase unable to CLEAN_INSERT

馋奶兔 提交于 2019-12-06 15:14:19
According to the DBUnit docs link it should support using a CLEAN_INSERT when using a DatabaseSequenceFilter. I get the following exception when attempting this com.sybase.jdbc2.jdbc.SybSQLException: Dependent foreign key constraint violation in a referential integrity constraint. dbname = 'my_db', table name = 'tbl_child', constraint name = 'fk_tbl_child_parentid'. My tables look like this: CREATE TABLE dbo.tbl_parent ( parent_id numeric(19,0) IDENTITY, ... ) CREATE TABLE dbo.tbl_child ( child_id numeric(19,0) IDENTITY, parent_id numeric(19,0) NOT NULL, ... ) ALTER TABLE dbo.tbl_child ADD

Cannot register Sybase 15 ASE OLE DB driver on Windows 7

冷暖自知 提交于 2019-12-06 09:28:54
问题 I am trying to get the Sybase 15 ASE OLE DB driver set up on my Windows 7 machine. I already have the Adaptive Server Enterprise driver listed in the Drivers tab of my 32-bit ODBC Data Source Administrator (C:\Windows\SysWOW64\odbcad32.exe). I tried to re-register the DLL with the command regsvr32 sybdrvoledb.dll and with C:\Windows\SysWOW64\regsvr32.exe sybdrvoledb.dll from a command prompt running as admin, and in both cases I get back "DllRegisterServer in sybdrvoledb.dll succeeded" but

Windows 8 OLEDB / ADO.NET drivers for Sybase ASE?

删除回忆录丶 提交于 2019-12-06 09:09:46
问题 Has anyone successfully installed Sybase OLEDB drivers and Sybase Central on a Windows 8 (64 bit) system? I've tried the installers on the Sybase website but they fail. Searches for "Windows 8" on the Sybase site and "Sybase Windows 8" on Google are bringing up nothing. We have a developer here who installed them on a Windows 7 system and then did an OS upgrade to Windows 8 so I know they will work. I would rather not uninstall Windows 8 and go that route if I can help it though. 回答1: I

Is there a good way to do this in SQL?

你。 提交于 2019-12-06 05:20:42
问题 I am trying to solve the following problem entirely in SQL (ANSI or TSQL, in Sybase ASE 12), without relying on cursors or loop-based row-by-row processing. NOTE: I already created a solution that accomplishes the same goal in application layer (therefore please refrain from "answering" with "don't do this in SQL"), but as a matter of principle (and hopefully improved performance) I would like to know if there is an efficient (e.g. no cursors) pure SQL solution. Setup : I have a table T with

Calling Sybase Adaptive Server Enterprise's “sp_help” from JDBC

爷,独闯天下 提交于 2019-12-05 23:06:34
In order to query the database meta data in Sybase ASE, I found this relevant answer (not the accepted one), to be ideal: From a Sybase Database, how I can get table description ( field names and types)? Unfortunately, I can't seem to find any documentation, how I'm supposed to call sp_help from JDBC. According to the documentation , sp_help returns several cursors / result sets. The first one contains information about the table itself, the second one about the columns, etc. When I do this: PreparedStatement stmt = getConnection().prepareStatement("sp_help 't_language'"); ResultSet rs = stmt

Upsert (update or insert) in Sybase ASE?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 20:01:43
问题 I'm writing an application to move data from Oracle to Sybase and need to perform update / insert operations. In Oracle, I'd use MERGE INTO, but it doesn't seem to be available in Sybase (not in ASE, anyway). I know this can be done with multiple statements, but for a couple of reasons, I'm really trying to get this into a single statement. Any suggestions? 回答1: ASE 15.7 has this feature. Find the docs here: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc36272.1570/html

I need Sybase datatype to save string of indefinite Length.

China☆狼群 提交于 2019-12-05 15:47:52
My requirement is to declare a datatype which accepts xml value with maximum size. Question: Do we have text, xml or varchar(max) datatype in Sybase? There is text datatype. You can find More information here . How to use it with procedure: create procedure settxt ( @txt text ) as begin select @txt end How to run the procedure: declare @txt text select @txt = 'Hello world' execute settxt @txt The code works for me, but maybe not for everyone. Here is solution with temporary table: create table #texttab ( txt varchar(100) ) go insert into #texttab values ('Hello ') insert into #texttab values (