我爱Aspx >> 数据库 >> 用sql语句修改数据表中字段 实现identity(100,1)的递增用sql语句修改数据表中字段 实现identity(100,1)的递增
>
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
【我对这篇文章有话说?】
不能作为“sysadmin”登录SQL Se..[05-22]
在SQL Server中使用存储过程的代..[05-22]
SQL Server中的模式匹配[05-22]
从动态SQL中返回值[05-22]
Sql Server基本函数[05-22]
sql日记(相关子查询,动态交叉表..[05-22]
在SQL中使用convert函数进行日期..[05-22]
SQL Server 2000游标使用方法[05-22]
SQL中的两个值得注意的特殊符号[05-22]
sql server 中各个系统表的作用[05-22]
分布式查询和分布式事务[05-22]
在存储过程中使用use database[05-22]
不能作为“sysadmin”登录SQL Se..[05-22]
在SQL Server中使用存储过程的代..[05-22]
SQL Server中的模式匹配[05-22]
从动态SQL中返回值[05-22]
xp_cmdshell[05-22]
Sql Server基本函数[05-22]
sql日记(相关子查询,动态交叉表..[05-22]
在SQL中使用convert函数进行日期..[05-22]