Disable PRINT in SQL Server

前端 未结 4 1718
抹茶落季
抹茶落季 2021-01-13 02:08

I have a script with many debug messages, which are printed by PRINT function. Is there any way to disable that messages? I have in mind something like SE

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 02:26

    Sometimes the simplest solution is the best... Make all your print statements that deal with debugging as follows:

    PRINT 'Debug ' + [WhateverStatementsYouDesire]
    

    Then you can do a search and replace

    PRINT 'Debug ' --> --PRINT 'Debug '
    

    Do the opposite Find and Replace to turn them back on again...

    (I do realize this is not quite what you were asking for but here is what I do for now. If there is such a switch as you are searching for I would probably change to that method.)

提交回复
热议问题