从下面的代码中,我们在 raiseerror 处遇到异常 - 当前事务无法提交,并且无法支持写入日志文件的操作。回滚事务。
IF @insertOrUdate = 'D'
BEGIN
-- DescType depends on CorrectionType and is also a protected sync table,
-- it needs to be cleared out before we can remove this type
IF EXISTS(
SELECT TOP 1 *
FROM [dbo].[DescType]
WHERE
[CorrectionTypeId] = @correctionTypeId
)
BEGIN
PRINT 'raise error'
RAISERROR('Dependent Desc Role Type Rollups must be removed prior to removing a type that they depend on', 16, 1)
PRINT 'after raise error'
END
-- Delete protected Sync record
DELETE FROM [dbo].[CorrectionType] WHERE [CorrectionTypeId] = @correctionTypeId;
END;