I've been struggling with a task which requires me to raise a number of errors for testing purposes. Of course the time consuming errors are between 1 and 13000. I've managed to do them, but I need to do it several times on multiple test instances and I wanted to ask if there's a way to raise SQL Engine errors which normally only could be raised by the engine itself. By 'a way', I mean any possible routes to generate those error messages.

The ultimate goal is that the messages appear in the current error log.

Any help would be appreciated!

1 Answer 1


Try RAISERROR syntax below;

          'Test error' -- Error message
          ,0 -- Severity
          ,1 -- State
         ) WITH LOG;

For more information, you can check out the document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.