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