Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Expressions Expand / Collapse
Author
Message
Posted Wednesday, August 07, 2013 9:21 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:01 AM
Points: 1,651, Visits: 5,201
Comments posted to this topic are about the item Expressions

MM


  • MMGrid Addin
  • MMNose Addin


  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • Post #1482119
    Posted Wednesday, August 07, 2013 9:25 PM
    Valued Member

    Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

    Group: General Forum Members
    Last Login: Wednesday, March 19, 2014 5:07 PM
    Points: 64, Visits: 87
    Moral of today's question. Be careful when using indeterministic functions inside nullif...
    Post #1482120
    Posted Wednesday, August 07, 2013 11:30 PM


    Ten Centuries

    Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

    Group: General Forum Members
    Last Login: Thursday, February 06, 2014 4:15 AM
    Points: 1,242, Visits: 1,546
    i have taken more time to answer this and learn something new.

    Thanks MM




    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!
    www.GrowWithSql.com

    Post #1482139
    Posted Wednesday, August 07, 2013 11:58 PM


    SSChampion

    SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

    Group: General Forum Members
    Last Login: Today @ 2:41 PM
    Points: 12,201, Visits: 9,156
    Very nice question. Thanks.



    How to post forum questions.
    Need an answer? No, you need a question.
    What’s the deal with Excel & SSIS?

    Member of LinkedIn. My blog at LessThanDot.

    MCSA SQL Server 2012 - MCSE Business Intelligence
    Post #1482144
    Posted Thursday, August 08, 2013 12:14 AM
    SSCrazy

    SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

    Group: General Forum Members
    Last Login: Thursday, April 03, 2014 3:33 PM
    Points: 2,526, Visits: 530
    Nice "tricky" question! Thank you!

    /Håkan Winther
    MCITP:Database Developer 2008
    MCTS: SQL Server 2008, Implementation and Maintenance
    Post #1482150
    Posted Thursday, August 08, 2013 1:07 AM


    SSCommitted

    SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

    Group: General Forum Members
    Last Login: Monday, April 14, 2014 11:50 PM
    Points: 1,867, Visits: 2,275
    Koen Verbeeck (8/7/2013)
    Very nice question. Thanks.

    +1



    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    Post #1482160
    Posted Thursday, August 08, 2013 1:12 AM
    SSC Eights!

    SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

    Group: General Forum Members
    Last Login: Today @ 4:39 AM
    Points: 818, Visits: 2,485
    Nice question thanks
    Post #1482162
    Posted Thursday, August 08, 2013 1:59 AM
    Grasshopper

    GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

    Group: General Forum Members
    Last Login: Thursday, April 03, 2014 11:06 PM
    Points: 21, Visits: 42
    How about
    newid() = '00000000-0000-0000-0000-000000000000'

    The question is not correct. Answer is 0 (zero).
    Post #1482172
    Posted Thursday, August 08, 2013 2:21 AM


    SSCrazy

    SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

    Group: General Forum Members
    Last Login: Monday, April 14, 2014 3:30 AM
    Points: 2,390, Visits: 2,281
    Very good explanation!
    Here is why the first select may return 1,-1,negative and the second only 1 and negative.
    The same side effect of "C" macros:
    #define abs(a) (a < 0? a*-1: a )

    int a = 1;
    print("Result %d",abs(++a));

    Result 3

    select 
    isnull(
    nullif( convert( varchar, sign( checksum( upper(newid()) ) ) ), '-1' )
    , 'negative'
    )
    declare @u uniqueidentifier = newid()
    select
    isnull(
    nullif( convert( varchar, sign( checksum( @u ) ) ), '-1' )
    , 'negative'
    )
    go 10

    Post #1482182
    Posted Thursday, August 08, 2013 2:26 AM
    SSCommitted

    SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

    Group: General Forum Members
    Last Login: Today @ 6:05 AM
    Points: 1,528, Visits: 5,172
    ok181ko (8/8/2013)
    How about
    newid() = '00000000-0000-0000-0000-000000000000'

    The question is not correct. Answer is 0 (zero).


    The question asked which of the answers were possible outputs of the statement. It never stated that *all* of the possible outputs were listed as answers. Plus, is it even possible for NEWID() to return a value that's all zeroes?
    Post #1482183
    « Prev Topic | Next Topic »

    Add to briefcase 12345»»»

    Permissions Expand / Collapse