2019-03-19 SQL Server简单存储过程的创建 删除 执行

--创建名为 Get 的有输入参数的存储过程
create proc Get
--设置默认值
@TrustId int ='001'       

as

begin
    select * from [DealStructure].[TrustManagement].[Trust] where TrustId=@TrustId
end

--执行名为 Get 的有输入参数的存储过程(不传参数,即使用默认值)
execute Get

--执行名为 Get 的有输入参数的存储过程(传入参数)
execute Get '66'

--删除存储过程
if exists(select * from sys.procedures where name=N'Get' )
	drop proc Get