|
Posted by WhytheQ on 08/17/07 10:56
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??
J
On 16 Aug, 21:23, Hugo Kornelis <h...@perFact.REMOVETHIS.info.INVALID>
wrote:
> 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 -
Navigation:
[Reply to this message]
|