如何用sql语句修改数据表中字段,实现identity(100,1)的递增

作者:未知 来源:未知 添加时间:2006年7月3日 字体:

create table common_info(
name varchar(10),
&#118alue int)
insert into common_info &#118alues('msg_count', 100)
你的sql应该这么写(用存储过程):
create proc p_ins_alm_msg
@msg_count int out
as
select @msg_count = &#118alue from common_info where name = 'msg_count'
update common_info set &#118alue = @msg_count+ 1 where name = 'msg_count' and &#118alue = 

@msg_count
if @@rowcount = 0
return -1000
insert into table1 (field0)
&#118alues(@msg_count)
return 0
go 

ppdesk