CHECKING specific values

  • The defaults with a US SQL Server are what I used. I'm not going to list out client settings, collations, etc. If your settings are different, then you'll need to adjust for these questions.

  • Sean Lange (2/23/2016)


    I am shocked at how many people (9% at time of this post) said there would be 4 rows. :w00t:

    Excellent question Steve.

    I'm not shocked; several people will be as careless as me :blush: and notice the NULL and then not bother to check whether the other values are valid, sust assuming (wrongly) that the behaviour with NULL is the only point to the question because that's the thing that most people get wrong and that many people claim (because they haven't a clue what the point of NULL is and why it is provided in SQL) is a bad part of the SQL specification of a CHeCk constraint.

    edit: I think the 22% who picked 2 as the answer are are far bigger problem that the 9% who picked 4 - I certinly wouldn't allow any of those 22% to do any schema design until I was certain that they have learned to understand and accept what NULLs are about and how check constraints work and realise that if they don't want to allow NULLs for a column they should declare it as NOT NULL (or, if they want to be stupid about it because they think they know better than Ted Codd, include "COL is not NULL" in their check constraint).

    Tom

  • Thanks for the question.

  • Thanks for the question.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 4 posts - 31 through 34 (of 34 total)

You must be logged in to reply to this topic. Login to reply