Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kgundava
Yak Posting Veteran
66 Posts |
Posted - 2011-08-04 : 00:43:01
|
| Hi all, I would like to select 1250 random rows in sql server using a function similar to oracle's sample function.please let me know if it is possible......Thanks........ |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-04 : 01:00:55
|
[code]select TOP 1250 *from yourtableorder by NEWID()[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
kgundava
Yak Posting Veteran
66 Posts |
Posted - 2011-08-04 : 08:03:12
|
| Thanks for the reply....As the tables are very large i do not want to use order by as it would take lot of time....Please let me know if there is any other way out (similar to oracle's sample function).Thanks,Krishna |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
kgundava
Yak Posting Veteran
66 Posts |
Posted - 2011-08-04 : 10:33:02
|
| Hi Visakh, Thanks For the reply. I have to actually do it on a linked server(attunity) and table sample does not support on linked servers.I do not know what is the syntax in Attunity.Please let me know is there any other way around which works on linked server as well. Thanks....... |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-08-04 : 10:46:04
|
| Use OPENQUERY:select * from openquery(linkedServer,'select FirstName, LastName from AdventureWorks.Person.Contact tablesample (10 percent)')If Attunity is based on SQL Server then this should work. |
 |
|
|
kgundava
Yak Posting Veteran
66 Posts |
Posted - 2011-08-04 : 11:05:14
|
| Thanks for the reply...I have tried this earlier but Attunity is not based on SQL server and i believe it is based on ANSI SQL.Please let me know any other way...Thanks.... |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-08-04 : 11:22:18
|
| Best I can suggest then is to find out which RDBMS platform it is using (Oracle, MySQL, etc.) or contact Attunity support, or go with khtan's method. |
 |
|
|
|
|
|