【SQL开源代码栏目提醒】:以下是网学会员为您推荐的SQL开源代码-307.sql,希望本篇文章对您学习有所帮助。
use db_Sql
GO
--判断pro_pro15存储过程是否存在,如果存在将他删除
if exists(select name from sysobjects
where name='proc_pro15'and type='p')
drop proc proc_pro15 --删除存储过程
GO
create procedure proc_pro15
as
declare @truc int
select @truc=@@trancount
if @truc=0
begin tran p1
else
save tran pl
if (@truc=2)
begin
rollback tran pl
return 25
end
if(@truc=0)
commit tran pl
return 0