开发者

Convert Oracle query about unique number to SQL Server 2008

开发者 https://www.devze.com 2023-03-23 19:14 出处:网络
Can anyone help me convert this from Oracle to SQL Server 2008? CREATE SEQUENCE seq 开发者_Go百科 MINVALUE 1

Can anyone help me convert this from Oracle to SQL Server 2008?

CREATE SEQUENCE seq

   开发者_Go百科 MINVALUE 1
    MAXVALUE 9999
    START WITH 1
    INCREMENT BY 5
    CACHE 30;

seq.nextval


There is no way to convert this to SQL Server as SQL Server is one of the few DBMS that does not support sequences.

If this is used to generate an artificial primary key, you need to look into identity columns or use GUIDs as a PK replacement.

But even if switch to identity columns there is no way to retrieve the "next value" for them. They are only assigned when inserting new rows.

0

精彩评论

暂无评论...
验证码 换一张
取 消