网乐原科技

直播中

news center新闻中心
首页 > 资讯中心 > 软件技术

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

发布时间:2008-07-12     阅读数: 次       来源:网乐原科技
create table common_info(
name varchar(10),
value int)
insert into common_info values('msg_count', 100)
你的sql应该这么写(用存储过程):
create proc p_ins_alm_msg
@msg_count int out
as
select @msg_count = value from common_info where name = 'msg_count'
update common_info set value = @msg_count+ 1 where name = 'msg_count' and value =

@msg_count
if @@rowcount = 0
return -1000
insert into table1 (field0)
values(@msg_count)
return 0
go

网乐原科技

客服热线:0771-5761507

QQ:53290011

QQ邮箱:53290011@qq.com

工作时间:周一到周五 9:00-18:00

地址:广西南宁市江南万达写字楼C16栋1309室

物联网开发

关注我们

微信小商店 腾讯QQ客服 微信客服