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 Thursday, August 8, 2013 2:26 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, December 15, 2014 8:05 AM
Points: 1,876, Visits: 518
Definitely learnt something new today! Was very confused at first but a great explanation too - makes it simple. - Thanks.
Post #1482184
Posted Thursday, August 8, 2013 2:44 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 4:13 AM
Points: 4,156, Visits: 5,549
Need my first cup of coffee before answering
Good question, thanks...


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1482188
Posted Thursday, August 8, 2013 4:20 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:17 AM
Points: 1,169, Visits: 2,541
Dang It! Did it again. I did NOT get my coffee before answering the question. Thus, missed it again. Good question.
Post #1482206
Posted Thursday, August 8, 2013 4:21 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:32 PM
Points: 6,128, Visits: 8,393
Good question!

*kicks self* - I knew this, have been bitten by it before, and STILL managed to get it wrong. Obviously need to be bittenn a lot more before it finally sinks in enough that I don't forget about it anymore... ;)



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1482207
Posted Thursday, August 8, 2013 4:31 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:25 AM
Points: 1,682, Visits: 19,599
Nice question, definitely learned something new.

____________________________________________________

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537

Never approach a goat from the front, a horse from the rear, or a fool from any direction.
Post #1482210
Posted Thursday, August 8, 2013 5:29 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 3:26 PM
Points: 305, Visits: 237
Only 18% of correct answers! Good question mate ...
Post #1482234
Posted Thursday, August 8, 2013 6:18 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, September 5, 2014 8:00 AM
Points: 21, Visits: 51
paul.knibbs (8/8/2013)
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?


And You can prove that this can not be?
Post #1482257
Posted Thursday, August 8, 2013 6:29 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 13, 2013 11:43 AM
Points: 242, Visits: 433
ok181ko (8/8/2013)
paul.knibbs (8/8/2013)
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?


And You can prove that this can not be?

I can prove that particular value to be irrelevant:

select checksum('00000000-0000-0000-0000-000000000000')
-1448389036

Of course, this does not mean that there isn't a value for newid that would provide a checksum of 0, only that the value you selected is not it.



Puto me cogitare, ergo puto me esse.
I think that I think, therefore I think that I am.
Post #1482266
Posted Thursday, August 8, 2013 6:42 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:32 PM
Points: 6,128, Visits: 8,393
srienstr (8/8/2013)
select checksum('00000000-0000-0000-0000-000000000000')
-1448389036

You're calculating the checksum of a value that just happens to loook remarkably like a uniqueidentifier value - but is just a plain old varchar.

select checksum(cast('00000000-0000-0000-0000-000000000000' as uniqueidentifier) )

Result: 0
(on my system)



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1482283
Posted Thursday, August 8, 2013 6:42 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, December 12, 2014 6:22 AM
Points: 531, Visits: 449
Excellent question, thanks!
Post #1482284
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse