May 27, 2011 at 10:27 am
I would like to know how to select random records from data in both sql server 2005 standard edition.
May 27, 2011 at 10:34 am
can you please be more specific about what do you need to do?
May 27, 2011 at 11:09 am
there's a trick that you can get randomly ordered records by using the NEWID() function...is that what you are after?
select top 10
ColumnList
From SomeTable
order By NEWID()
and this?
in both sql server 2005 standard edition.
in both SQL 2005 and what? oracle? sql 2008?
Lowell
May 27, 2011 at 11:19 am
Lowell (5/27/2011)
there's a trick that you can get randomly ordered records by using the NEWID() function...is that what you are after?
select top 10
ColumnList
From SomeTable
order By NEWID()
and this?
in both sql server 2005 standard edition.
in both SQL 2005 and what? oracle? sql 2008?
That's a very quick way of doing this.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
May 27, 2011 at 11:30 am
The method using NEWID works well.
TABLESAMPLE is pretty handy too:
http://technet.microsoft.com/en-us/library/ms189108.aspx
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply