1. 无参数
2. 有参数:
-1 创建存储过程,设置两个传入的参数 name 和author
create proc usp_book(@name nvarchar(50),@author nvarchar(50))
as
begin
-- select * from book where name=@name and author=@author
-- 设置变量
declare @all varchar(500)
select @all = convert(varchar(30),getdate(),121)
print @all
select @name
print @name
print 'print --------------'
print @author
select @author
end
-2. 执行存储过程,注意参数(两种方法都可以)
exec usp_book @name='金x梅',@author='不认识'
exec usp_book "金x梅","不认识"
浙公网安备 33010602011771号