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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-17 : 09:10:36
|
| Raj writes "I want to have a sequence generated number in SQL server. I can use the identity column, but that would mean that I don't have the control over the number. Is there a way to circumvent this. To overcome this, I thought of maintaining the the list of such columns with the counters in a table and then thru a procedure incrementing and getting the next value(something equal to sequencename.nextval of Oracle). For this the update to this table needs to be instantaneous i.e irrespective of whether this procedure is called withing a transaction or not, this update has to be commited instantaenously without affecting the state of the previously opened transation. This might result in the loss of some sequence numbers but atleast this will not result in duplicate numbers. I know that we can have a PRAGMA AUTONOMOUS TRANSACTION in Oracle to do this. Is there a similar one in SQL 7.0. Also is there any other way to have this implemented." |
|
|
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2001-12-17 : 09:41:33
|
| You can turn the identity number off if you want more control over it although you would probably have to be careful if you did.SET IDENTITY_INSERT <TABLE_NAME> ON+something like that |
 |
|
|
JustinBigelow
SQL Gigolo
1157 Posts |
Posted - 2001-12-17 : 10:16:17
|
| Actually you can manage the seed value of an identity column. Using DBCC CHECKIDENT you can check identity values and either leave it alone or reseed the value.Justin |
 |
|
|
|
|
|