NEWID function in mssql

Posted by Emil under Sql Server on 11/21/2012 | Points: 10 | Views : 1432 | Status : [Member] | Replies : 2
For generating a random alpha-numeric string i am using NEWID()

In the generated string i am using 4 charcters like substring(newid(),1,4)

Can anyone confirm whether there any chance of getting repeating string after a long time for the above mentioned statements ouput?




Responses

Posted by: Pandians on: 11/21/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Definitely YES!

It'll repeate!

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kundan64 on: 1/3/2013 [Member] Starter | Points: 25

Up
0
Down
Yes, it will be Repeate.
When you will use full Newid() value e.g (6E729922-2B38-4B1E-AF57-042EE61537A2), then the chance of repetation for 2,600,000,000,000,000,000 GUID is 1%.

Emil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response