![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This doesn't work: --**************************************** USE myDatabase SELECT TOP 10 * FROM myTable WHERE NEWID() --**************************************** ..I know I need to use the function newID() to find random records - just don't know where it fits in the query (suspect the TOP will need to go from the above) Any help greatly appreciated |
#3
| |||
| |||
|
|
This doesn't work: --**************************************** USE myDatabase SELECT TOP 10 * FROM myTable WHERE NEWID() --**************************************** ..I know I need to use the function newID() to find random records - just don't know where it fits in the query (suspect the TOP will need to go from the above) Any help greatly appreciated J |
#4
| |||
| |||
|
|
On Thu, 16 Aug 2007 03:39:49 -0700,WhytheQwrote: This doesn't work: --**************************************** USE myDatabase SELECT TOP 10 * FROM myTable WHERE NEWID() --**************************************** ..I know I need to use the function newID() to find random records - just don't know where it fits in the query (suspect the TOP will need to go from the above) Any help greatly appreciated J Hi J, Marcin's answer is correct. However, if you're on SQL Server 2005 you can also use the new TABLESAMPLE option (see Books Online for the details); this will probably perform better on large tables. -- Hugo Kornelis, SQL Server MVP My SQL Server blog:http://sqlblog.com/blogs/hugo_kornelis- Hide quoted text - - Show quoted text - |
#5
| |||
| |||
|
|
Hugo Kornelis wrote: Marcin's answer is correct. However, if you're on SQL Server 2005 you can also use the new TABLESAMPLE option (see Books Online for the details); this will probably perform better on large tables. |
p.s. You blog is to large for pageflakes (max 512000 bytes) could youmaybe cut down the articles in the feed ? |
#6
| |||
| |||
|
|
Do you have a link to the book you are talking about ? |
p.s. You blog is to large for pageflakes (max 512000 bytes) could youmaybe cut down the articles in the feed ? |
#7
| |||
| |||
|
|
This comes up with nothing: '===================== USE myDatabase SELECT * FROM myTable TABLESAMPLE (1 ROWS) '==================== ...whereas this works: '===================== USE myDatabase SELECT * FROM myTable TABLESAMPLE (1 PERCENT) '==================== Any ideas?? |
#8
| |||
| |||
|
|
Søren Reinke (soren (AT) REMOVE (DOT) reinke.dk) writes: Hugo Kornelis wrote: Marcin's answer is correct. However, if you're on SQL Server 2005 you can also use the new TABLESAMPLE option (see Books Online for the details); this will probably perform better on large tables. See my signature. Or your hard disk (if you have SQL Server installed). |


p.s. You blog is to large for pageflakes (max 512000 bytes) could youmaybe cut down the articles in the feed ? Pageflakes? http://www.pageflakes.com/ |
#9
| |||
| |||
|
p.s. You blog is to large for pageflakes (max 512000 bytes) could youmaybe cut down the articles in the feed ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |