I have a script (that will be put into a nightly JOB) that does inserts and updates on tables and rollbacks if there is an error. I do not understand the difference between Print and Select. When I run the script with Print, it shows my error. When I run
the script with Select, it does not show anything. Can someone tell me what I should be using so the nightly job will record any errors?
Insert into TABLE1 VALUES(1,2,3)
SELECT @errsaved = @@error
If @errorsaved <> 0 begin
Print 'Error - Transaction will be rolled back' , @errsaved
SELECT 'Error - Transaction will be rolled back', @errsaved
View Complete Post