SQL 2008 Driver not returning SQL_NULL_DATA for null values. - sqlserver-odbc
This is a discussion on SQL 2008 Driver not returning SQL_NULL_DATA for null values. - sqlserver-odbc ; 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 ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| 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) { } else { } 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. |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 07:07 PM.




Linear Mode