1、@@ERROR
返与@@ERROR 近语句错误码局限于DML语句select语句执行现错误则返等于0错误码没错则返0通使用判断语句没执行功
-- Create Schema if not one exists with same name and owner set @stmtS = ‘create schema ‘ set @stmtS = @stmtS + quotename(@rolename, ‘]‘) set @stmtS = @stmtS + ‘ authorization ‘ set @stmtS = @stmtS + quotename(@rolename, ‘]‘) BEGIN TRANSACTION -- issue DDL to create the role -- exec (@stmtR) if @@error <> 0 begin ROLLBACK TRANSACTION return (1) end