Integer lengths (I)

  • Stewart "Arturius" Campbell (7/1/2015)


    ArnoKwetters (7/1/2015)


    Is NULL=NULL true ?

    NULL != NULL or anything else.

    NULL is actually a reflection of the state of the field, i.e. there is no value assigned to it.

    This is where playing aound with SET ANSI_NULL delivers some interesting results...

    Thank u!

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Stewart "Arturius" Campbell (7/1/2015)


    ArnoKwetters (7/1/2015)


    Is NULL=NULL true ?

    NULL != NULL or anything else.

    NULL is actually a reflection of the state of the field, i.e. there is no value assigned to it.

    This is where playing aound with SET ANSI_NULL delivers some interesting results...

    [/quote

    Yes, my question and answer assume ANSI_NULL is set on; that is the default situation for sQL Server, and the ability to set it off has been deprecate for a very long time and will soon be unavailable. Any comparison involving NULL (either as both arguments or as one f them) delivers UNKNOWN - not TRUE, and not FALSE.

    Tom

  • Stewart "Arturius" Campbell (7/1/2015)


    ArnoKwetters (7/1/2015)


    Is NULL=NULL true ?

    NULL != NULL or anything else.

    NULL is actually a reflection of the state of the field, i.e. there is no value assigned to it.

    This is where playing aound with SET ANSI_NULL delivers some interesting results...

    Slight (pedantic) correction: NULL = NULL is never true, but NULL != NULL is also never true. And both statements are never false either. They are "unknown" - welcome to the wonderful world of three-value logic!

    An excellen write-up on this: http://sqlblog.com/blogs/hugo_kornelis/archive/2007/07/17/the-logic-of-three-valued-logic.aspx and http://sqlblog.com/blogs/hugo_kornelis/archive/2007/09/22/dr-unknown-or-how-i-learned-to-stop-worrying-and-love-the-null.aspx (Me, biased? Never! :cool:)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Good blog, Hugo.

    NULL is fascinating !

  • Thanks for the question. Never used the str() function.

    How very strange that it would return a left padded string of default length 10 given BOL says its return type is varchar, not char. What is the point of returning varchar if it is padded? Is this maybe some sybase legacy?

    https://technet.microsoft.com/en-us/library/ms189527(v=sql.110).aspx

  • I've spent a lot of time with STR.

Viewing 6 posts - 16 through 20 (of 20 total)

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