Re: Sybase ASE OLE DB Provider adCmdStoredProc bug

Tech-Archive recommends: Speed Up your PC by fixing your registry



Jose Luis (jose.luis.fdez.diaz@xxxxxxxxx) writes:
When I exec a sybase procedure from Visual Basic, the "NULL
comparation" (if xxx = NULL) doens't run. However if the sintax is "if
xxx is NULL" it runs fine.

I don't really know what you mean with "doesn't run", but I assume
that if you have:

IF @x = NULL
PRINT '@x is = NULL'
ELSE
PRINT '@x is not known to be = NULL'

This prints the latter, no matter @x is NULL or not.

This is the expected behaviour in SQL. All comparisons with NULL yields
the value UNKNOWN. NULL stands for "unknown value", and if both @x and @y
are NULL, they may not be the same unknown value. Therefore, for all tests
you should use @x IS [NOT] NULL.

Originally, Sybase did not adhere to this, and if you run the above in
Sybase 4.x it will indeed print '@x is = NULL' if @x is NULL. Some
time after Microsoft had separated from Sybase, they add the SET option
ANSI_NULLS, and since SQL 7 this option is ON by default in most contexts.
I have not worked with Sybase for many years, but I have occasionally
glanced in their documentation, and I seem to recall that they too have
a ANSI_NULLS SET option.

In any case @x IS [NOT] NULL is what you should use with any DB engine.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Migrating SQLServer DBs to Sybase
    ... Server-generated scripts to create the structure in Sybase, and SQL Server ... AseConnection objCon = new AseConnection; ... objCon.ConnectionString = strConnectionString; ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Scheduling DTS job
    ... If you try to transfer the same rowsfrom SQL Server to SQL Server ... > How do i see if there is any difference in the driver ... >>> The SQL server agent is running as Local System Account. ... >>> Nothing has been changed in sybase box. ...
    (microsoft.public.sqlserver.dts)
  • RE: Numeric Overflow of Column of datatype Money
    ... Sybase driver is failing on the column, long before it reaches SQL Server. ... That I have serveral column with datatype money that didnt have the ...
    (microsoft.public.sqlserver.dts)
  • RE: Connecting to Sybase
    ... Have you tried pushing the data directly into AS using SSIS, ... This paper describes push mode processing in more detail: ... issue with pulling the data from Sybase on a daily basis and putting it into ... a Sql server table then having ssas get the data from there. ...
    (microsoft.public.sqlserver.olap)
  • Re: MS SQL server & Sybase interoperability
    ... > I have an application build on Sybase database, and we waant to install MS ... We are using Sybase ASA and SQL Server 2000 on the same machine. ... Installing SQL Server 2000 AFTER installing Sybase did not cause ... caused problems with the ODBC dlls. ...
    (microsoft.public.sqlserver.server)