It’s that time of the year again!

Draft Day is near! Here is some SQL to randomly determine the draft order

 

IF OBJECT_ID(‘TEMPDB..#PICKS’) IS NOT NULL

      DROP TABLE #PICKS

CREATE TABLE #PICKS

(

      NAME VARCHAR(50)

)

 

INSERT INTO #PICKS VALUES(‘Player 1’)

INSERT INTO #PICKS VALUES(‘Player 2’)

INSERT INTO #PICKS VALUES(‘Player 3’)

INSERT INTO #PICKS VALUES(‘Player 4’)

INSERT INTO #PICKS VALUES(‘Player 5’)

INSERT INTO #PICKS VALUES(‘Player 6’)

INSERT INTO #PICKS VALUES(‘Player 7’)

INSERT INTO #PICKS VALUES(‘Player 8’)

INSERT INTO #PICKS VALUES(‘Player 9’)

INSERT INTO #PICKS VALUES(‘Player 10’)

  

SELECT      ROW_NUMBER() OVER(ORDER BY NEWID()),

            NAME

FROM #PICKS

Advertisements