SQL RAISERROR 用法

DECLARE @raiseErrorCode nvarchar(50)
SET @raiseErrorCode = CONVERT(nvarchar(50), YOUR UNIQUEIDENTIFIER KEY)
RAISERROR('%s INVALID ID. There is no record in table',16,1, @raiseErrorCode)
RAISERROR (
             N'This is message %s %d.', -- Message text,
             10,                        -- Severity,
             1,                         -- State,
             N'number',                 -- First argument.
             5                          -- Second argument.
          ); 
-- The message text returned is: This is message number 5.

 

posted @ 2015-08-07 16:10  bobo-bobo  阅读(675)  评论(0)    收藏  举报