|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Data SamplingIs there a function to randomly select certain percent of the data from a
table each time? Not in SQL. You really need to use a Stat package that can interface
with the RDBMS. It will have all of the corrections that you need for a proper sample. What is a Stat Package?
Show quote "--CELKO--" wrote: > Not in SQL. You really need to use a Stat package that can interface > with the RDBMS. It will have all of the corrections that you need for > a proper sample. > > Not easily in 2000. A trick is to do some thing like this would be
(assuming you want 25% of a 100 row table) select top 25 * from table order by newid() It doesn't give you all of the performance improvements of a proper sampling function (since a sort will be required on a newly introduced value) but it should give you all of the other characteristics. -- Show quote---------------------------------------------------------------------------- Louis Davidson - http://spaces.msn.com/members/drsql/ SQL Server MVP "Lianne Kwock" <LianneKw***@discussions.microsoft.com> wrote in message news:8B65E57D-4CB5-4626-8085-435ED6C2C228@microsoft.com... > Is there a function to randomly select certain percent of the data from a > table each time? You could something like that
Select TOP 5 from Sometable order by New_id() HTH, Jens Suessmeyer. Show quote "Lianne Kwock" <LianneKw***@discussions.microsoft.com> wrote in message news:8B65E57D-4CB5-4626-8085-435ED6C2C228@microsoft.com... > Is there a function to randomly select certain percent of the data from a > table each time? Sure,
Select TOP 25 Percent Col1, Col2,.... From Table Where.... Order By... The Order By statement is obviously key to returning the expected results. Thomas Show quote "Lianne Kwock" <LianneKw***@discussions.microsoft.com> wrote in message news:8B65E57D-4CB5-4626-8085-435ED6C2C228@microsoft.com... > Is there a function to randomly select certain percent of the data from a > table each time? |
|||||||||||||||||||||||