• Thank you for this post! I found a small problem in the first block of code. PRINT 'ANSI_WARNINGS is OFF'

    is not executed because SELECT @userOptions = @@OPTIONS; is executed before ANSI_WARNINGS is reset.