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 2000 Forums
 Transact-SQL (2000)
 sequence number

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-03 : 10:31:44
Wayne writes "In sqlserver is there some sort of sequence number holder which can then be used in an insert statement.
ie insert into table (column1, column2, column3)
select sequence.nextvalue, columny, columnz from some other table;"

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2005-08-03 : 10:43:18
As per my knowledge there is no such sequence number holder in sql server like there in oracle.but u can create a table of ur own that can store last no generated. like table with two columns : sequenceid, lastseqgen. and when everyou give query this table to insert into another table then increment the lastseqgen.

Kapil Arya
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-03 : 15:35:07
Welcome to SQL Team Wayne!

In SQL Server if your table contains a column with the IDENTITY attribute defined then it will automatically be assigned the next available number when you do an INSERT (you can leave it off the column list for the Insert statement)

Kristen
Go to Top of Page
   

- Advertisement -