Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Random number-9 digits only

Author  Topic 

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2008-03-25 : 09:40:45
Hi,

I need to generate random numbers that will always contain 9 digits.
How can I do that?
Thanks

Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-25 : 09:53:15
SELECT ABS(CHECKSUM(NEWID())) % 900000000 + 100000000



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -