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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s