AutoNumber Trigger in MS SQL [message #372427] |
Mon, 12 February 2001 13:06 |
Paul Springer
Messages: 1 Registered: February 2001
|
Junior Member |
|
|
Does anyone know how to write a trigger in MICROSOFT SQL to replace the AutoNumber feature that is available when us Access as your database. I understand that Oracle has Sequences and Triggers but I do not see that in MS SQL 7.0. I only see triggers.
There has to be a pretty simple way to do this, right?
Someone, please help. . .
Thx in advance
|
|
|
Re: AutoNumber Trigger in MS SQL [message #374185 is a reply to message #372427] |
Tue, 29 May 2001 17:07 |
JOHN
Messages: 182 Registered: April 1998
|
Senior Member |
|
|
Instead of using autonumber, set the type to int, don't allow nuls, set it as an identity, and leave increment and the the stating number at 1. Or feel free to mess around with those two if it suits you. Setting the field as an identity enable the trigger that does what you want.
~John after a long day. Hope it was coherent.
|
|
|