sql server sql语句创建序列怎么写?

2024-12-25 06:46:10
推荐回答(2个)
回答1:

增加属性应该是这样写的吧
ALTER TABLE cust_id ADD cust_id_seq number(9) identity(1,1)

如果你要搞sequence
CREATE SEQUENCE cust_id_seq
INCREMENT BY 1
START WITH 1
MAXVALUE 999999999
NOCYCLE;

增加的时候用cust_id_seq.nextval

回答2:

你看看解决了不
alter table cust_info add sequence int
insert into cust_info (sequence)
select row_number() over(order by cust_id) as cust_id_seq from cust_info