|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,040,
Visits: 1
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, March 12, 2010 12:23 PM
Points: 2,146,
Visits: 2,507
|
|
One of five orders?
Wouldn't a simple
SELECT TOP 20 PERCENT OrderID FROM Table1 ORDER BY NEWID()
do?
N 56°04'39.16" E 12°55'05.25"
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 6:35 PM
Points: 20,151,
Visits: 13,688
|
|
Steve... I'm not sure what's happened, but this article is all but unreadable. Might look fine from Firefox, but IE8 is having a heck of a time with it.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Today @ 4:15 PM
Points: 746,
Visits: 840
|
|
Seems this article is also in random order ? 
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, March 12, 2010 12:23 PM
Points: 2,146,
Visits: 2,507
|
|
And it's also well established that
ABS(CHECKSUM(NEWID())) % 100
gives random numbers between 0 and 99 with very high, good and even distribution.
N 56°04'39.16" E 12°55'05.25"
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, January 20, 2010 2:58 AM
Points: 269,
Visits: 151
|
|
| You have a run-away <pre> block in there after the first result set which is breaking the formatting. (and I didn't expect to have to html encode <)
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Wednesday, July 08, 2009 1:48 AM
Points: 27,
Visits: 54
|
|
Not sure if number of rows matter if this was just for audit purpose I suppose you would not be strict on number of rows.
select * from invoice tablesample (10 percent)
This might work as well.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, March 10, 2010 11:02 AM
Points: 22,
Visits: 70
|
|
| NewID() create a unique ID, but with CHECKSUM it seems cannot guarantee to be unique again.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: 2 days ago @ 10:58 AM
Points: 8,
Visits: 86
|
|
| I'm with Peso on this one.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 6:45 AM
Points: 22,
Visits: 152
|
|
| The XLeratorDB function library inlcudes a RANDBETWEEN scalar function which works just like the EXCEL RANDBETWEEN function. You could have just included RANDBETWEEN(1, 5) in your select and you would have gotten the results you wanted. You can find out more about this function at http://www.westclintech.com/Documentation/XLeratorDBmathDocumentation/tabid/140/topic/RANDBETWEEN/Default.aspx
|
|
|
|