sqlserver 简单的事物用法

SELECT * FROM Interface_UserPort


BEGIN TRY
    BEGIN TRAN Tran_2012_12_25
        INSERT INTO dbo.Interface_UserPort VALUES(2,3)
        --raiserror 50005N'抛出错误' 
    COMMIT TRAN Tran_2012_12_25
END TRY
BEGIN CATCH
    raiserror 50005N'出错了' 
    ROLLBACK TRAN Tran_2012_12_25
END CATCH

 

posted @ 2013-12-25 16:25  ``炯``  阅读(278)  评论(0编辑  收藏  举报