SQL and Database
Showing posts with label
newid()
.
Show all posts
Showing posts with label
newid()
.
Show all posts
Wednesday, 12 December 2012
How to get random record from table in SQL
To get random record from table we use
NEWID
()
function. Example
USE
AdventureWorks
SELECT
TOP
1
*
FROM
Production
.
Document
ORDER
BY
NEWID
()
NEWID
()
is used to generate
UNIQUEIDENTIFIER
SELECT
NEWID
()
Older Posts
Home
Subscribe to:
Posts (Atom)