sybase

how to pass a comma separated list to a stored procedure?

So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause: CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) How do I call my stored proc with more than 1 value in the list? So far I've tried exec getSom...

Best method for varchar date validation in Sybase (T-SQL)?

I have a stored procedure which takes as its parameter a varchar which needs to be cast as a datetime for later use: SET @the_date = CAST(@date_string AS DATETIME) I'm expecting the date string to be supplied in the format "DD-MON-YYYY", but in an effort to code defensively, if for some reason it can't be cast successfully, I want to ...

How do I avoid using cursors in Sybase (T-SQL)?

Imagine the scene, you're updating some legacy Sybase code and come across a cursor. The stored procedure builds up a result set in a #temporary table which is all ready to be returned except that one of columns isn't terribly human readable, it's an alphanumeric code. What we need to do, is figure out the possible distinct values of th...

Select Query on 2 tables, on different database servers

I am trying to generate a report by querying 2 databases (Sybase) in classic ASP. I have created 2 connection strings: connA for databaseA connB for databaseB Both databases are present on the same server (don't know if this matters) Queries: q1 = SELECT column1 INTO #temp FROM databaseA..table1 WHERE xyz="A" q2 = SELECT ...

*= in Sybase SQL

I'm maintaining some code that uses a *= operator in a query to a Sybase database and I can't find documentation on it. Does anyone know what *= does? I assume that it is some sort of a join. select * from a, b where a.id *= b.id I can't figure out how this is different from: select * from a, b where a.id = b.id ...

Oracle equivalent to SQL Server/Sybase DateDiff

We are now using NHibernate to connect to different database base on where our software is installed. So I am porting many SQL Procedures to Oracle. SQL Server has a nice function called DateDiff which takes a date part, startdate and enddate. Date parts examples are day, week, month, year, etc. . . What is the Oracle equivalent? I...

What is the difference between UNION and UNION ALL

What is the difference between UNION and UNION ALL. ...

Best use of indices on temporary tables in T-SQL

If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says this: "the table must contain data when the index is created. If you create the temporary table and create the index on an e...

How to convert a string to a date in sybase

I need to specify a date value in a sybase where clause. For example: select * from data where dateVal < [THE DATE] ...

Case insensitive search on Sybase

I have been sick and tired Googling the solution for doing case-insensitive search on Sybase ASE (Sybase data/column names are case sensitive). The Sybase documentation proudly says that there is only one way to do such search which is using the Upper and Lower functions, but the adage goes, it has performance problems. And believe me th...

Good books on Sybase ASE 15?

We need to get some good books on Sybase ASE 15 for our developers. The people in the team have previous experience with different SQL flavors (MS SQL, MySQL, Informix and Oracle) but no one worked with Sybase before. Therefore I am looking for two kinds of books: Book for developers on how to use Sybase for queries,sprocs, views etc....

Any good SQL Anywhere database schema comparison tools?

Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. I tried using DB Solo, but it turned all my non-unique indexes into unique ones, and I didn't see any optio...

Unable to close OledbDataReader to Sybase Database in VB.NET

I don't seem to be able to close the OledbDataReader object after reading data from it. Here is the relevant code - Dim conSyBase As New OleDb.OleDbConnection("Provider=Sybase.ASEOLEDBProvider.2;Server Name=xx.xx.xx.xx;Server Port Address=5000;Initial Catalog=xxxxxxxxxx;User ID=xxxxxxxx;Password=xxxxxxxxx;") conSyBase.Open() Dim cmdSy...

SQL Anywhere 11 (Sybase) with Entity Framework in Visual Studio SP1?

Well, the question is pretty much in the title. I've just installed Visual Studio SP1, and now when I want to import a Entity Model from a database, it doesn't display the SQL Anywhere provider anymore. Does anyone know if there is a patch or some way to make it work with SP1? Thanks. ...

Sybase Developer Needs To Learn Oracle

I am pretty much a Sybase expert, an experienced developer, and very comfortable learning new stuff. I need to write a bunch of SQL to run against an Oracle database. Can someone recommend a book, training course or other resource to give me what I need to know in the shortest possible time? I don't need Oracle for Dummies, but someth...

What is the list of JConnect error-codes?

I have recently changed an application from storing the database username and password in a configuration file (gasp password stored in plain text in a config file, I know, I know). The application now asks the user to type in her username and password before it can continue. The new version of the application now has to interrogate th...

Difference between drop table and truncate table?

I have some tables that I build as a part of my report rollup. I don't need them afterwards at all. Someone mentioned to truncate them as it would be faster. ...

Aqua Data Studio - Shortcuts for Autocomplete

When the autocomplete listbox/dropdown is displayed in Aqua Data Studio, you have to hit enter in order for the current hightlighted item to complete the identifier. Is there a way that I can hit the tab key to autocomplete instead? This is the default behavior for Visual Studio and I cannot find the keyboard shortcuts editor in Aqua Dat...

Is there any thing such as SELECT LAST in sql query?

I am using sybase database to query the daily transaction report. I had subquery within my script. Here as it goes: SELECT orders.accountid ,items.x,etc (SELECT charges.mistotal FROM charges where items.id = charges.id) FROM items,orders WHERE date = '2008-10-02' Here I am getting the error message as Subquery cannot return more than...

Sql Server 2005 SSIS unable to enlist SYBASE distributed transaction

Good morning, I know very little (arguably nothing) about SYBASE setup, but I do know SSIS is having trouble enlisting SYBASE in a distributed transaction. Has anyone been able to make this work? The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x80004005 "Unspecified error". This h...