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 «««23456

Random problems Expand / Collapse
Author
Message
Posted Wednesday, June 10, 2009 8:58 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 9:39 AM
Points: 19, Visits: 14
Peso (6/9/2009)
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.


I like this solution - it is simpler than the one I proposed.
Post #732724
Posted Wednesday, June 10, 2009 9:35 PM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 12:14 AM
Points: 36,735, Visits: 31,186
christian_nowicki (6/10/2009)
Peso (6/9/2009)
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.


I like this solution - it is simpler than the one I proposed.


Well done, Chris! Takes a hell of a good person to say such a thing in the discussion of their own article. There should be more like you.


--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 #732732
Posted Thursday, June 11, 2009 5:30 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 15, 2011 4:04 AM
Points: 4, Visits: 12
Hello, I've found this article very interesting but I can't find the Row_Number() function. Is it part of SQL Server 2k8 (I've only 2k5) ?
Post #732934
Posted Thursday, June 11, 2009 5:44 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 3:35 PM
Points: 2,393, Visits: 3,399
ROW_NUMBER() was introduced with SQL Server 2005 and need the compatibiity level set to 90 or higher.



N 56°04'39.16"
E 12°55'05.25"
Post #732943
Posted Thursday, June 11, 2009 3:08 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 15, 2011 4:04 AM
Points: 4, Visits: 12
Thank you very much for your answer but I already found the response. I deleted my message but apparently it didn't work.
Post #733371
Posted Thursday, June 11, 2009 9:19 PM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 12:14 AM
Points: 36,735, Visits: 31,186
benoit.rocco (6/11/2009)
Thank you very much for your answer but I already found the response. I deleted my message but apparently it didn't work.


Cool. Tell us what it was. Two way street here.


--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 #733482
Posted Saturday, June 13, 2009 5:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 15, 2011 4:04 AM
Points: 4, Visits: 12
I was using SQL Server Management Studio, but connected to a SQL2000 server, it's for that reason the function ROW_NUMBER() didn't exist ^^
Post #734307
Posted Saturday, June 13, 2009 11:08 AM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 12:14 AM
Points: 36,735, Visits: 31,186
benoit.rocco (6/13/2009)
I was using SQL Server Management Studio, but connected to a SQL2000 server, it's for that reason the function ROW_NUMBER() didn't exist ^^


Ah... thank you Benoit. That would certainly do 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 #734381
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse