Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Random problems Rate Topic Display Mode Topic Options
Author
 Message
 Posted Monday, June 8, 2009 9:52 PM
 SSChampion Group: General Forum Members Last Login: Friday, May 18, 2007 3:36 PM Points: 10,041, Visits: 1
Post #731102
 Posted Monday, June 8, 2009 11:57 PM
 SSCrazy Group: General Forum Members Last Login: Tuesday, April 14, 2015 6:45 AM Points: 2,403, Visits: 3,431
 One of five orders?Wouldn't a simpleSELECT TOP 20 PERCENT OrderIDFROM Table1ORDER BY NEWID()do? N 56°04'39.16"E 12°55'05.25"
Post #731149
 Posted Tuesday, June 9, 2009 12:06 AM
 SSC-Forever Group: General Forum Members Last Login: Today @ 9:17 AM Points: 42,051, Visits: 39,438
Post #731152
 Posted Tuesday, June 9, 2009 12:51 AM
 Ten Centuries Group: General Forum Members Last Login: Wednesday, September 21, 2016 12:13 PM Points: 1,015, Visits: 1,352
Post #731176
 Posted Tuesday, June 9, 2009 1:00 AM
 SSCrazy Group: General Forum Members Last Login: Tuesday, April 14, 2015 6:45 AM Points: 2,403, Visits: 3,431
 And it's also well established thatABS(CHECKSUM(NEWID())) % 100gives random numbers between 0 and 99 with very high, good and even distribution. N 56°04'39.16"E 12°55'05.25"
Post #731187
 Posted Tuesday, June 9, 2009 3:11 AM
 SSC Veteran Group: General Forum Members Last Login: Wednesday, November 9, 2016 4:39 AM Points: 282, Visits: 215
 You have a run-away
block in there after the first result set which is breaking the formatting. (and I didn't expect to have to html encode <)
Post #731250
 Posted Tuesday, June 9, 2009 6:54 AM
 SSC Rookie Group: General Forum Members Last Login: Wednesday, September 30, 2015 7:12 PM Points: 27, Visits: 64
 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.
Post #731400
 Posted Tuesday, June 9, 2009 7:13 AM
 SSC Rookie Group: General Forum Members Last Login: Tuesday, August 30, 2016 8:32 AM Points: 35, Visits: 365
 NewID() create a unique ID, but with CHECKSUM it seems cannot guarantee to be unique again.
Post #731412
 Posted Tuesday, June 9, 2009 7:23 AM
 Grasshopper Group: General Forum Members Last Login: Tuesday, May 28, 2013 6:52 AM Points: 16, Visits: 166
 I'm with Peso on this one.
Post #731426
 Posted Tuesday, June 9, 2009 7:37 AM
 Grasshopper Group: General Forum Members Last Login: Friday, September 17, 2010 4:24 PM Points: 23, Visits: 172
 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
Post #731434

 Permissions