Sql server抛出异常(RAISERROR)
Posted 荆棘鸟的栖息地
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sql server抛出异常(RAISERROR)相关的知识,希望对你有一定的参考价值。
create PROCEDURE [dbo].[spTASKS_ASSIGNED_Update] ( @ID UNIQUEIDENTIFIER OUTPUT , @MODIFIED_USER_ID UNIQUEIDENTIFIER = NULL , @ASSIGNED_USER_ID UNIQUEIDENTIFIER = NULL ) AS DECLARE @ASSIGNED_USER_NAME NVARCHAR(100); SELECT @ASSIGNED_USER_NAME = ASSIGNED_TO_NAME FROM dbo.vwTASKS WHERE ID = @ID; IF @ASSIGNED_USER_NAME IS NULL BEGIN UPDATE [TASKS] SET [MODIFIED_USER_ID] = @MODIFIED_USER_ID , [DATE_MODIFIED] = GETDATE() , [ASSIGNED_USER_ID] = @ASSIGNED_USER_ID , STATUS = ‘In progress‘ WHERE [ID] = @ID; END; ELSE BEGIN RAISERROR (N‘Submit failed, this task is assigned to %s!‘, 16, -- Severity. 1, -- State. @ASSIGNED_USER_NAME ); END;
以上是关于Sql server抛出异常(RAISERROR)的主要内容,如果未能解决你的问题,请参考以下文章