Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Random problems Expand / Collapse
Author
Message
Posted Monday, June 8, 2009 9:52 PM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
Comments posted to this topic are about the item Random problems
Post #731102
Posted Monday, June 8, 2009 11:57 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 3:35 PM
Points: 2,393, Visits: 3,399
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"
Post #731149
Posted Tuesday, June 9, 2009 12:06 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:14 PM
Points: 36,784, Visits: 31,241
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #731152
Posted Tuesday, June 9, 2009 12:51 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 2:57 AM
Points: 928, Visits: 1,116
Seems this article is also in random order ?

Wilfred
The best things in life are the simple things
Post #731176
Posted Tuesday, June 9, 2009 1:00 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 3:35 PM
Points: 2,393, Visits: 3,399
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"
Post #731187
Posted Tuesday, June 9, 2009 3:11 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, April 9, 2014 9:26 AM
Points: 281, Visits: 181
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 <)
Post #731250
Posted Tuesday, June 9, 2009 6:54 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, August 22, 2012 7:35 PM
Points: 27, Visits: 62
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

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Today @ 12:09 PM
Points: 35, Visits: 293
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

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

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

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

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
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse