举个例子,这是在一张表中的某条记录的某个字段值加1,并返回原值,你在query中写下
面的sql语句就行了
CREATE PROCEDURE GetNumber
@Fieldname varchar(50),
@Reccount int output
AS
begin
update NumberGroup
set Idnumber=Idnumber+1,@Reccount=Idnumber where Idname=@Fieldname
select idnumber from Numbergroup where Idname=@Fieldname
end