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: SQL Server, April Fool Joke