1.表
2.无参
ALTER PROCEDURE kxy_proc AS BEGIN update Student set Age=Age+1 where ID=1 END
调用
exec kxy_proc
3.有输入参数
ALTER PROCEDURE kxy_proc @id int, @name varchar(10) AS BEGIN update Student set Age=Age+1 where ID=@id and Name=@name END
调用
exec kxy_proc 1,kxy
4.有输出参数
ALTER PROCEDURE kxy_proc @id int, @age int OUTPUT AS BEGIN SELECT @age=s.Age from Student s WHERE s.ID=@id; end
调用
DECLARE @age int exec kxy_proc 1,@age OUTPUT SELECT @age as age