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

Quickly Generate Random number by TSQL with 99.9% Uniqueness Guarntee Expand / Collapse
Author
Message
Posted Monday, September 14, 2009 4:17 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 30, 2009 5:30 PM
Points: 1, Visits: 8
Comments posted to this topic are about the item Quickly Generate Random number by TSQL with 99.9% Uniqueness Guarntee
Post #787291
Posted Thursday, September 17, 2009 8:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 13, 2010 8:55 AM
Points: 1, Visits: 4
I was not able to run the script. I pasted use temdb as first line. I am using SQL Server Management studio 2008 as client and SQL server 2005 as server.

following are the errors that i was getting

Msg 102, Level 15, State 1, Line 10
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 11
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ')'.
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 22
Incorrect syntax near ' '.
Msg 208, Level 16, State 1, Line 5
Invalid object name 'tblTest'.
Msg 3701, Level 11, State 5, Line 3
Cannot drop the table 'tblTest', because it does not exist or you do not have permission.
Post #789699
Posted Thursday, September 17, 2009 8:58 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Wednesday, June 4, 2014 10:28 AM
Points: 1,434, Visits: 412
Very cool. My results were 1080 duplicate numbers, each appearing twice. No number returned 3 times. Out of 3 million, that's 99.96% unique.
Post #789707
Posted Thursday, September 24, 2009 2:07 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, August 22, 2014 1:56 PM
Points: 60, Visits: 178
I had the same issue.
I copied the code into TextPad and got rid of the leading "spaces" within the CTEs. For example, there are 4 characters at the beginning of the line "Select 1 as n" that aren't really spaces.

Post #793555
Posted Friday, September 25, 2009 4:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 30, 2009 5:30 PM
Points: 1, Visits: 8
I checked the issue. This is due to some unprintable characters inserted by HTML. To solve this issue, copy the code in notepad first and you wil see the box for unprintable chracters. Just replace all occurances of that character with a space. After this, Copy the code from notepad and paste it in your Query Analyzer window. It will work like a charm.
Post #793741
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse