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
 SQL Server Development (2000)
 Converting Oracle sql query to SQl Server

Author  Topic 

deven
Starting Member

3 Posts

Posted - 2001-12-26 : 03:08:43
I am converting a Oracle database driven application into Sql Server based. Can any one write me what is the equivalent SQl Server query for the following Oracle query.

SELECT Seq_Order_ID.NextVal seq FROM Dual

Thank Yo
Deven



Deven

sona
Yak Posting Veteran

68 Posts

Posted - 2001-12-26 : 06:48:08
you can try this

Select Max(Seq_Order_ID)+1 from Dual

Go to Top of Page

smccreadie
Aged Yak Warrior

505 Posts

Posted - 2001-12-26 : 07:14:48
There's no Dual in SQL Server. SQL supports an identity data type which automatically increases the value of every row. If you have an identity field defined, there's no need to manually increment the value.

HTH

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2001-12-26 : 07:35:09
Yeah as smccreadie puts it therez no dual( or dummy table) in Sqlserver.

To add on that , there are no sequences in Sql Server like available in Oracle. But as suggested by smccreadie you can use a identity field which does autoincrement on its own on insertion of every record.

HTH

-------------------------
Graz's Baby is my Master:)
Go to Top of Page
   

- Advertisement -