SELECT TOP 10 userID FROM user ORDER BY NEWID()
or
SELECT TOP 10 NEWID() [egg], userID FROM user ORDER BY [egg]
or
SELECT TOP 10 NEWID(), userID FROM user ORDER BY 1
only tried the above with TSQL
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
SELECT TOP 10 userID FROM user ORDER BY NEWID()
SELECT TOP 10 NEWID() [egg], userID FROM user ORDER BY [egg]
SELECT TOP 10 NEWID(), userID FROM user ORDER BY 1
You need to create an account or log in to post comments to this site.
» Dynamic ordering without dyn... in sql tsql
» find duplicates in sql tsql
» Retrieve MSSQL table informa... in sql server tsql mssql table microsoft column information properties sysproperties systables data type types length columns
» Scripting schema updates in ... in sql tsql database mssql schema update tables microsoft columns query scripting information_schema alter altering
» iSQL sucks, so make it work ... in sql unix linux tsql language query transact structured odbc isql unixodbc
» A query from ActiveRecord th... in sql activerecord
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails