0

NULLS: SQL Server 2000 vs SQL Server 2005

MS SQL

The 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.

For more on SSWUG visit their web site here.

Good Day!
Ryan

tags:
MS SQL
todd sharp said:
 
Good Tip EV - thanks for passing along.

Personally I can't stand the SSWUG site - they sent *way* too many emails out when I was signed up. It got to be annoying to me so I unsubscribed.
 
posted 942 days ago
Add Comment Reply to: this comment OR this thread
 
 
I listen to their webcasts every now and again. That way I feel like I'm learning something new.
 
posted 942 days ago
Add Comment Reply to: this comment OR this thread
 

Search