Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SQL 2008 Driver not returning SQL_NULL_DATA for null values.

 
   Database Help (Home) -> ODBC RSS
Next:  Holiday Dates  
Author Message
CdSlc

External


Since: Oct 30, 2008
Posts: 1



(Msg. 1) Posted: Thu Oct 30, 2008 11:12 am
Post subject: SQL 2008 Driver not returning SQL_NULL_DATA for null values.
Archived from groups: microsoft>public>sqlserver>odbc (more info?)

I have this ODBC code that runs fine with SQL 2005 Native Driver connected to
a SQL 2005 database. The same code gives me a different result when I use the
SQL 2008 Native Driver connected to a SQL 2008 database (or for that matter
the problem happens even for SQL 2008 Native Driver connected to SQL 2005
database). So, the problem seems to be with the SQL 2008 Native Driver.

My stripped down version of the ODBC code is as shown below:


long lPtr = 0;
SQLBindCol(myQuery, 1, SQL_C_LONG, &myId, 0, &lPtr);
SQLFetch(myQuery);
if (lPtr == SQL_NULL_DATA)
{
<do something for null data>
}
else
{
<do something for non-null data>
}


For this particular column, the value that is stored in the database is NULL
and that I have verified using the SQL 2008 Management Studio.

When the app is run using SQL 2005 Driver, the variable "lPtr" contains
SQL_NULL_DATA (which is defined as -1 in the SQL.H file)
When the app is run using SQL 2008 Driver, the variable "lPtr" contains 0
(which is the value for SQL_SUCCESS in the SQL.H file)

Now, is this a problem with SQL 2008 Native Driver? Is there some setting or
some parameter that can give me the same result in 2008 as I get in 2005? Or
have I unwittingly stumbled into a SQL 2008 bug?

Thanks.

 >> Stay informed about: SQL 2008 Driver not returning SQL_NULL_DATA for null values. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SQL Server 2008 + ODBC SQL Driver 2000.85.1022 - Hello, Could machine having ODBC SQL Driver version 2000.85.1022 connect properly to SQL Server 2008 on other machine? This version of ODBC driver is default in windows 2000 and it works improperly with SQL Server 2008. It produces random errors in..

Problem with Microsoft Access ODBC driver - Hi, For some reason Microsoft's ODBC driver for MS Access reports an index for every foreign key that exists on a table. For example, consider the two tables. create table parent(id integer primary key) create table child (cid integer, id integer..

[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRea.. - Hello, i an custiomer environment, we have sporadic ODBC Errors. This ist the error message: [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()) Environment: Client/Server with Windows Server 2003 Enterprise OS, new Service Packs...

SQL Server 2005 Link server to ODBC driver *SEVERE ERROR* - I am using the latest IBM INFORMIX ODBC DRIVER 3.00.00.13223 - ICLIT09B.DLL I then use a SQL Server 2005 link server – Microsoft OLE DB Provider for ODBC Driver. Both ODBC and SQL Server Linked server test connection successfully and I can return..

SQL Native Client vs SQL Server Driver - I'm developing an application that must support connecting to SQL Server 2005 as well as SQL Server 2000. Which driver should I use for the connection? 1. Use SQL Native Client driver for both 2005 and 2000. 2. Use SQL Server driver for both 2005 and..
   Database Help (Home) -> ODBC All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]