首页 > 数据库 > SQL Server > sqlserver中定义过程
今天需要写sqlserver过程 ,参考一个朋友的blog
http://yaoronghui2005.itpub.net/admin.php?op=editPost&postId=494044
[@more@]2009-11-24 今天编辑一个过程调用
alter procedure p_process @id varchar(10), @v_name varchar(20) output
as
select @v_name=name from t_test t where id = @id;
exec p_process @id='1', @v_name output[雨林木风1]
exec p_process '1', @v_name output 正确写法1
EXEC p_process @id='1', @v_name = [雨林木风2] out //正确写法2
DECLARE @v_name varchar(200)
set @v_name = ''
EXEC p_process @id='1', @v_name = output
if @v_name <> ''
begin
select * from t_test where name = @v_name;
end
else if @v_name = ''
begin
raiserror('no row found',10,1);
end
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/450962/viewspace-1029009/ ,如需转载,请注明出处,否则将追究法律责任。