阴阳师契约书怎么用:数据库事务示例

来源:百度文库 编辑:九乡新闻网 时间:2024/07/04 18:58:00
USE [StudentManage]
GO
/****** Object:  StoredProcedure [dbo].[st_info]    Script Date: 08/10/2011 17:42:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GOALTER proc [dbo].[st_info]
(@name varchar(20),
@nation varchar(10)
)
as
begin tran
declare @message int,@num int set @num=0beginupdate dbo.StudentInfo set Name='我爱你' where Name=@nameset @num=@num+@@ROWCOUNTif (@@ERROR<>0)
begin
set @num=0
rollback tran
end
else
commit tran
return @num
end