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 7, 2013 9:21 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 3:53 PM
Points: 1,780, Visits: 5,750
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 7, 2013 9:25 PM
    Valued Member

    Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

    Group: General Forum Members
    Last Login: Sunday, September 28, 2014 2:45 PM
    Points: 64, Visits: 92
    Moral of today's question. Be careful when using indeterministic functions inside nullif...
    Post #1482120
    Posted Wednesday, August 7, 2013 11:30 PM


    Ten Centuries

    Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

    Group: General Forum Members
    Last Login: Thursday, February 6, 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 7, 2013 11:58 PM


    SSChampion

    SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

    Group: General Forum Members
    Last Login: Today @ 5:05 AM
    Points: 13,045, Visits: 10,809
    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 8, 2013 12:14 AM
    SSCrazy

    SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

    Group: General Forum Members
    Last Login: Today @ 1:38 AM
    Points: 2,582, Visits: 553
    Nice "tricky" question! Thank you!

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


    SSCommitted

    SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

    Group: General Forum Members
    Last Login: 2 days ago @ 12:09 AM
    Points: 1,916, Visits: 2,337
    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 8, 2013 1:12 AM
    Ten Centuries

    Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

    Group: General Forum Members
    Last Login: 2 days ago @ 11:51 AM
    Points: 1,040, Visits: 3,106
    Nice question thanks
    Post #1482162
    Posted Thursday, August 8, 2013 1:59 AM
    Grasshopper

    GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

    Group: General Forum Members
    Last Login: Friday, September 5, 2014 8:00 AM
    Points: 21, Visits: 51
    How about
    newid() = '00000000-0000-0000-0000-000000000000'

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


    SSCrazy

    SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

    Group: General Forum Members
    Last Login: 2 days ago @ 7:33 AM
    Points: 2,542, Visits: 2,410
    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 8, 2013 2:26 AM
    SSCommitted

    SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

    Group: General Forum Members
    Last Login: Yesterday @ 7:18 AM
    Points: 1,594, Visits: 5,633
    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