I am using SQL Server 2005, please tell me how can I get 6 digits (unique numeric which should be random) value for every row in table.
I have a field in table in which I need 6 digit numeric value (random and unique).
Please help me to do this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
for a phone number:
NEWID is about as random as you can get in SQL Server.
However, if you want unique, you may as well start at 000000 and go to 999999. Any random generator will hit the birthday problem.
You can have unique or random that are reliable, but not both reliably