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 |
rocking25
Starting Member
5 Posts |
Posted - 2009-01-12 : 06:42:22
|
I am using SQL SERVER 2005. I have a table named 'Punchdata' with four primary key. But I want a column named 'PunchdataID',I can't declare that column as a Primary Key.So I want to creat a sequence which should execute when a new row is inserted in the table. and the PunchdataID should get auto incremented.So I want a Sequence and a trigger to execute that sequence. If sequence is not required than it will better. |
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-01-13 : 10:47:44
|
No need for trigger etc, make the column an IDENTITY columne.g.alter TABLE Punchdataadd [PunchdataID] [int] IDENTITY(1,1) NOT NULL |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-13 : 12:13:04
|
and if its a custom sequence you want which is autogenerated you can create a computed column based on identity column value for that |
 |
|
|
|
|