Answers for "sql server throw error in transaction"

SQL
0

sql server throw exception

THROW 51000, 'The record does not exist.', 1;
Posted by: Guest on February-03-2021
0

sql server throw exception

USE tempdb;  
GO  
CREATE TABLE dbo.TestRethrow  
(    ID INT PRIMARY KEY  
);  
BEGIN TRY  
    INSERT dbo.TestRethrow(ID) VALUES(1);  
--  Force error 2627, Violation of PRIMARY KEY constraint to be raised.  
    INSERT dbo.TestRethrow(ID) VALUES(1);  
END TRY  
BEGIN CATCH  
  
    PRINT 'In catch block.';  
    THROW;  
END CATCH;
Posted by: Guest on February-03-2021

Code answers related to "sql server throw error in transaction"

Code answers related to "SQL"

Browse Popular Code Answers by Language