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)
 how to insert randome and unique value?

Author  Topic 

chih
Posting Yak Master

154 Posts

Posted - 2009-02-04 : 21:36:56
Hi all,

we want to insert random and unique value (about 8 digits char). Is there a way to do so? Thank you in advance

AvanthaSiriwardana
Yak Posting Veteran

78 Posts

Posted - 2009-02-04 : 22:32:16
use IF (Len(Filedname) = 8)
BEGIN
INSERT statement ......
END



Avantha Siriwardana
Beware of bugs in the above code; I have only proved it correct, not tried it.
(Donald Knuth)
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-02-05 : 01:10:02
i think these will be useful check this once
http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/20/random-password-generator.aspx
Go to Top of Page
   

- Advertisement -