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 |
sql2010
Starting Member
6 Posts |
Posted - 2010-03-31 : 15:24:19
|
Hi everyone,I have not worked on SQL server before. Can you tell me how to select the sequence in SQL server- what is the syntax?Select sequence.nextval from dual - this is used in oracleselect nextval(sequence) - this is used in postgresWill this work in sql server -- select sequence.nextval??Thanks in advance. |
|
PackRat
Starting Member
26 Posts |
Posted - 2010-03-31 : 16:33:20
|
sequences as they are known in Oracle are not represented in Sql Server as of yetif you're working on a table with an identity column (of which only one per table is allowed)you can get the equivalent of CurVal with IDENT_CURRENT([table name])and NextVal with IDENT_CURRENT([table name]) + IDENT_INCR([table name])depending on what exactly you're trying to accomplish, might want to look at the ROW_NUMBER function as well_____________________________wrote this on my TRS-80 COCO4<PakRat/> |
|
|
borgdr123
Starting Member
1 Post |
Posted - 2010-05-13 : 10:28:57
|
HI, Yes, sequences as they are known in Oracle are not represented in Sql Serve.......Thanks,http://www.vpswebserver.com |
|
|
|
|
|