01 April 2008 05:41 tonyrogerson

Rude easter egg in SQL 2005 - Uniqueidentifier gives the F0FF

I found this while researching a blog article; very interesting - I always thought code was put in place to prevent this sort of thing from happening.

Only seems to work on SQL Server 2005 SP1.

set language british
set ansi_defaults off
set ansi_nulls on 

declare @uid uniqueidentifier 
set @uid = newid() 

declare
@tb table ( blah char(36) not null ) 

insert @tb values( cast( @uid as char(36) ) ) 

select cast( blah as uniqueidentifier ), *
from @tb 

Gives the result set ->

F0FFB2EE-F0FFEEEEE-F0FF-F0FFEEEEF0FF,   A3193E14-77CF-491A-AF1B-EFD1CF235152

Post a comment if you tried without luck; there is something else to it, possibly regional settings - I'll work through it with you.

Tony.

 

Filed under: ,

Comments

# re: Rude easter egg in SQL 2005 - Uniqueidentifier gives the F0FF

01 April 2008 12:48 by GrumpyOldDBA

Can't reproduce this sorry. Vanilla install, w2k3 r2 sp2, sql dev x32, regional settings for server is UK. Standard install of sql 2005 with windows default collation.

as base install can't reproduce, installed sp1, still can't reproduce.

tried changing login default language.

my sp2 sql boxes don't do this. I can leave the sql at sp1 for a little while if you have any other config changes I should make?

# re: Rude easter egg in SQL 2005 - Uniqueidentifier gives the F0FF

01 April 2008 12:52 by GrumpyOldDBA

hmm .. April Fool eh?  I suppose if you cast back to something it'll read april fool?

# re: Rude easter egg in SQL 2005 - Uniqueidentifier gives the F0FF

01 April 2008 16:28 by GrumpyOldDBA

see my second comment shortly after didn't arrive - suppose it spells april fool with a cast to something?

# re: Rude easter egg in SQL 2005 - Uniqueidentifier gives the F0FF

03 April 2008 06:45 by tonyrogerson

Yep - this was an April's fool joke :)

Many thanks for the entertainment Colin - I'll be pulling your leg for ever more at UG meetings.

:)

Tony.