Created
November 20, 2009 19:39
-
-
Save DoubleBrotherProgrammer/239710 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- var to hold random value | |
declare @field_val int | |
-- create table var to hold value range [ 0, 512, 1024, 1536, 2048 ] | |
SELECT 0 AS 'num' | |
INTO #temp | |
-- insert data into table var | |
INSERT INTO #temp VALUES ( 512 ) | |
INSERT INTO #temp VALUES ( 1024 ) | |
INSERT INTO #temp VALUES ( 1536 ) | |
INSERT INTO #temp VALUES ( 2048 ) | |
-- assign random value | |
SELECT TOP 1 @field_val = num FROM #temp ORDER BY NEWID() | |
-- show value | |
SELECT @field_val | |
-- drop it | |
DROP TABLE #temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment