SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,492 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Why the raiserror not worked within begin try? Here is the code:
BEGIN TRY
--Check
RAISERROR ('Error! Please retry', 10, 2)
--If no errors
PRINT 'Successful'
END TRY
Hi @Lora Have you checked if the severity level issue? How about change the severity level to >10? See: RAISERROR
Best regards, Cosmog Hong
You have specified the severity as 10, which only generates an informational messages (and for some reason results in severity level 0, which is the same as PRINT.)
Specify the severity level as 16, which is the highest level for user errors.