Possible Duplicate:
Select n random rows from SQL Server table
I have database and table like that:
Persons
id Name
-- -----
1 Jim
2 John
3 Jaimy
I want to pick one row in the result randomly. Is there any function in SQL Server?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This might do it for you –
The Random purists won’t like it. It works by generating a new GUID for each row.
It might also hurt performance if you have a lot of rows in the
Personstable. Ideally you’d want to find a way to minimise the number of rows that you run that over first.There is a more detailed answer in this question that might answer the question fully.