That's a little different. I thought you said random "values", not "strings". Of course, you could convert the following to strings.
--===== Create the list of the first 1,000,000 integers
-- and establish a random sort order for usage.
-- The ISNULL''s are to make the columns NOT NULL
SELECT SortOrder = IDENTITY(INT,1,1)
,UniqueRandomValue = ISNULL(t.N,0)
,IsUsed = ISNULL(0,0)
FROM dbo.fnTally(1,1000000) t
ORDER BY NEWID()
is pronounced "ree-bar
" and is a "Modenism
" for R
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
"Change is inevitable... change for the better is not".
"If "pre-optimization" is the root of all evil, then what does the resulting no optimization lead to?"
How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)