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.
Author |
Topic |
SanjaySutar
Starting Member
18 Posts |
Posted - 2008-03-25 : 08:41:24
|
Hi , i just want to know how to create a formula for generating unique alphanumeric key for primary key set as identity using formula option.thanx in advance San |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-25 : 08:44:39
|
You can't.However you can use INT for IDENTITY column and then make a unique calculated column based on the identity value. E 12°55'05.25"N 56°04'39.16" |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
Chas
Starting Member
2 Posts |
Posted - 2008-04-02 : 22:15:34
|
The anwers of the others are much more comprehensive, but this is what I use to generate unique numbers:ALTER PROCEDURE RPNdxUpdateAS SET NOCOUNT ONUPDATE rp1SET ndx =(SELECT COUNT(rp2.[OFF])FROM dbo.RP rp2WHERE (rp2.Date + rp2.[OFF]) < (rp1.Date + rp1.[OFF]))FROM dbo.RP rp1RETURNIn the RP table the Date and [Off] columns are never null and in combination are always unique.Chas |
 |
|
|
|
|