sybase

How can I escape single and double quotes in SQL prepared statement?

I have a SQL statement similar to the one shown below in Perl: my $sql="abc..TableName '$a','$b' "; The $a is free text which can contain anything including single quotes, double quotes, back- and front-slash characters, etc. How can these characters be escaped to make the SQL statement work? Thanks. ...

Unexpected rounding when using ISNULL in sybase sql anywhere

Hi there, I have to work with a legacy system based on SQL Anywhere 5, db access layer is in C++ using embedded SQL. The problem I have is not really a C++ problem, but embedded SQL forces us to SQL statements which cannot be dynamically generated. There are many tables containing a lot of columns having the datatype double. Though the ...

sybase user defined function - "non deterministic" or "illegal built-in function" error

When trying to create a user-defined functions (UDFs) on sybase 15+, you may get the following error: "illegal built-in function statement in scalar SQL function" This is b/c "non deterministic" functions such as getdate(), rand(), newid() are not allowed in UDFs. Is there a way around this limitation? Note that I plan answer my own qu...

Any tips for a Sybase developer learning SQLServer?

I'm an experienced Sybase developer (10+ years) looking to branch out into SQLServer. Does anyone have any advice on good courses / books to help me transition? Thanks. ...

How to connect from Delphi to Sybase Sql Server?

How can I connect from Delphi to Sybase Sql Server? I want to be able to make querys, execute stored procedures, reference views, etc., all the things that the server allows me to do. Are there any components (like the dbGo components) or something like that? ...

Stored procedure does not return data if executed from VBA

I had stored procedure MySPOld in Sybase db. I created new sp MySP. This new sp returns data while executed from Sybase Sql Advantage. But not returning the data when called from VBA - Excel 2003 (EOF property of recordset is True). Here is my code.. Dim dbCon As ADODB.Connection Dim rstTemp As New ADODB.Recordset Dim query As String qu...

Recommended resources for learning database development with Cocoa?

I am currently learning Cocoa. However I am coming from a traditional Sybase/Oracle background using Powerbuilder. Having been spoiled by the 'power' of a datawindow for may years, I not sure that coredata or sqllite will satisfy my needs and ideas. Basically I'm looking for some good reference sites, books, or just plain old advice on...

Sybase Stored Procedure ResultSet streaming?

I am certain that this is documented somewhere, but I can't seem to find it. Does anybody know if JDBC stored procedure results are streamed in Sybase? In particular, if I use a CallableStatement to call a Sybase stored procedure, is it possible for the Java code start to read rows from the resulting ResultSet before the stored procedu...

Sybase JConnect : ENABLE_BULK_LOAD usage

Can anyone out there provide an example of bulk inserts via JConnect (w/ENABLE_BULK_LOAD) to Sybase ASE? I've scoured the internets and found nothing. I'm running on a short timeline so if someone can provide a short java code example it would be much appreciated. Thanks, Chris ...

I have a sybase database in a file. How do I determine for which version of sybase it is for?

Hello, I've been handed a file which appears to me to be a Sybase database file from some older Sybase version. I have d-loaded the latest sybase package from sybase and tried using that to connect to the contents but failed. Can someone suggest to me how to determine which version of sybase (and perhaps even which sybase db product) my...

Can I do an ASP.NET Dynamic Data project against a Sybase database?

Or must it be a SQL Server database? If I'm reading the documentation right, as long as I use Entity Framework and not Linq to SQL, I can go against a Sybase data source. But I'm not certain... ...

How to reverse the sp_hidetext command?

It appears that it can't be done, but I really don't know why. When Sql Server executes an stored procedure it needs it's code to run it, so I'm sure that the stored procedure's code must exists in some place, but I don't know where, either. Maybe this code is encrypted, but it could be decrypted with some tool, since the DBMS needs to ...

sybase trigger to find the deleted querry

hi , In my sybase server, some rows of a table (TBL_RESOURCE) are deleting from unknown source at random intervals.I tried a lot, but i cannot able to locate from which source/file/process this data is deleting.Is there any mechanism to locate this problem !! i need to find out who is deleting this rows.. how we can find out who is dele...

How to INSERT INTO table DEFAULT VALUES in Sybase ASE

When you want to insert default values into a table, some databases allow this syntax: INSERT INTO table DEFAULT VALUES; ASE does not support this. Using: INSERT INTO table (col2, col3) VALUES (DEFAULT, DEFAULT) and skipping the identity column works for columns with constant default values, but not for computed columns including ti...

Introspecting DEFAULT values and computed columns in Sybase ASE

For a Perl library that dumps Sybase schemas for DBIx::Class (::Schema::Loader), I need to be able to introspect DEFAULTs and computed columns. Suppose we have: create table bar ( id INTEGER IDENTITY PRIMARY KEY, foo VARCHAR(10) DEFAULT 'foo', adt AS getdate(), ts timestamp ) Here's as far as I got: select substring(c.name,1...

How to search in sql for hour/minutes?

I have to search all rows with a filter with specific hour and minute. Example: 26/05/2009 - 16:00 26/05/2009 - 17:00 10/11/2009 - 09:00 10/11/2009 - 10:00 10/11/2009 - 11:00 10/11/2009 - 12:00 I want all rows with hour/minute "17:00" and "18:00". And the date is optional field. I don't know how to do this. I'm using "sql anywhere ...

Remove bias from the monthly totals

In order to remove the bias introduced by the differences in the number of days in the months and years (in case of leap years), from monthly total comparisons of arbitrary quantities and assuming, for example, a table named My_Table with a datetime column named order_date, and an integer one named revenue, I use the following query to g...

Getting messages 1-20, 21-40,... from a database

I'm trying to build a mailbox where we can group the messages in x. If you put x to 20 you'll see messages 1-20 on the first page, opening the second page will show message 21-40 etc. How do I efficiently query this? The best I could come up with is this: select top 20 * from tbl_messages where tnr_id not in ( select top 40 tnr_i...

Execute Multiline sybase statement with java.sql.Statement

How can I both set rowcount and then execute a query in a Statement.executeQuery() function? note I don't want to use Statement.setMaxRows() to do this ...

Performance differences between jconn2 and jconn3

Hi, I have tested jconn2 and jconn3 on same application which is connected to sybase ase15.03 server . But I encountered the really big performance differences between these two api. For example I have run a simple select query on a big table (which contains 7051328 rows 20 cols). JCONN2 returns the resultset in 5.3sec but jconn3 retur...