mandag den 26. august 2013

Generating n number of GUID's with a TSQL query


Self-explanatory title, here's the snippet:


DECLARE @i int = 0
DECLARE @tmp_Accounts TABLE (
Id UniqueIdentifier
)

WHILE @i < 24 BEGIN
    SET @i = @i + 1
    
 INSERT INTO @tmp_Accounts (Id)
SELECT newid();
END

select * from @tmp_Accounts

HTH

Ingen kommentarer:

Send en kommentar