|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:31 AM
Points: 65,
Visits: 443
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 5:01 PM
Points: 10,990,
Visits: 10,545
|
|
An interesting article on an important subject. I would have rated it 5 stars instead of 4 if it had gone further in explaining what might need to be done to fix potential problems - sadly it is not as simple as replacing = NULL with IS NULL.
ANSI_NULLS OFF behaviour is decidedly odd, and often counter-intuitive, no wonder Microsoft are keen to stop supporting it. I have an example of this type of weirdness pending as a Question of the Day (QotD) so I'll just say that one example of weirdness involves IN and NOT IN...
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: 2 days ago @ 10:25 AM
Points: 18,754,
Visits: 12,337
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 5:01 PM
Points: 10,990,
Visits: 10,545
|
|
CirquedeSQLeil (1/26/2010)
Good article. I couldn't add anything more than what Paul has already indicated. Maybe a follow-up article on the same subject to go along with that QOD?  Good idea...
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 11:37 PM
Points: 4,
Visits: 452
|
|
Nice article, just followed your steps on our databases. 
Though for general purpose, I'm missing some short explanations on ANSI settings and as you check them in step 2) and it's not only about ANSI NULL.
In step 4) I first was kind of surprised as the sql-statement will find other "= NULL"s, too (e.g. SET @Var = NULL). But it shows a starting point for checking your code automatically and fast.
Best regards
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:31 AM
Points: 65,
Visits: 443
|
|
| I'm happy people are finding some value in the article; I had sent in a rough draft to see if it would be a topic of interest but they published it without asking me to tighten it up. My main purpose for writing the article was to show people how to be able to rip out all ANSI type statements from all their scripts and to never have to think again about any odd behavior of nulls on a per script basis.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 19, 2012 1:33 AM
Points: 3,
Visits: 36
|
|
Most interesting but I have a little query.
Why is it necessary to have a function for comparing nullable ints but not for any other data types? Is there something specific about nullable ints?
Kind regards Andy
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:31 AM
Points: 65,
Visits: 443
|
|
andy.gray (1/27/2010) Most interesting but I have a little query.
Why is it necessary to have a function for comparing nullable ints but not for any other data types? Is there something specific about nullable ints?
Kind regards Andy
The need for nullable compares is for all data types. I only have three in place for int, varchar, and datetime types so far for my needs. With a simple find/replace you can generate the others.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 2:36 PM
Points: 145,
Visits: 164
|
|
I'm probably stirring up a hornet's nest here but I have a problem with the way you are treating nulls. The whole point of null is that the value is undefined so comparing a value and saying they are equal if both are null is not valid. Two columns and/or variables are equal if and only if the values are defined and equal. Code should be aware of nulls and deal with them but not by equating two null values.
Richard
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 9:52 PM
Points: 28,
Visits: 169
|
|
I have been bitten by the IN/NOT IN null before...it's a tough one that had me scratching my head for an hour or so. That would make a good qod. --Jim
|
|
|
|