NULLS: SQL Server 2000 vs SQL Server 2005
MS SQLThe following information came from the SSWUG.ORG newsletter I get daily. I thought it was interesting and thought I'd share it.
An Interesting Difference: SQL Server 2000 to 2005
We've run into an oddity, or at least something to be aware of, when moving to SQL Server 2005 from 2000. If you have a column that is a varchar() that allows NULLs, and you're using ADO to access your SQL Server, there is at least one case where you can get different results back. The case is specifically where you're looking to get the len(gth) of the string returned from SQL Server. With SQL Server 2000, we were seeing a length of zero ("0") returned for a NULL value. With 2005, we're getting back NULL. It tripped up some routines on the site and I thought I'd pass it along. Makes sense, but odd that it gets different treatment through ADO (directly executed SELECT statements return NULL for len(gth) as expected). We now check both length and NULL return values.
We've run into an oddity, or at least something to be aware of, when moving to SQL Server 2005 from 2000. If you have a column that is a varchar() that allows NULLs, and you're using ADO to access your SQL Server, there is at least one case where you can get different results back. The case is specifically where you're looking to get the len(gth) of the string returned from SQL Server. With SQL Server 2000, we were seeing a length of zero ("0") returned for a NULL value. With 2005, we're getting back NULL. It tripped up some routines on the site and I thought I'd pass it along. Makes sense, but odd that it gets different treatment through ADO (directly executed SELECT statements return NULL for len(gth) as expected). We now check both length and NULL return values.
For more on SSWUG visit their web site here.
Good Day!
Ryan





Loading....