Sometimes it is a need to select random rows from a table or view. You can use NEWID() function to order rows randomly. Here is the code.
select * from dbo.Table1 order by NEWID()
You will see that every selection order is different than the other if have enough row set
No comments:
Post a Comment