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 SET NOCOUNT ON
, but for user messages.
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Print background image on every page once
- Code for inserting data into SQL Server database u
- Python: print in two columns
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
I like to set a variable, @Debug tinyint in my scripts/SPs.
Default/set this to 0 to suppress messages, 1 to show messages.
Then instead of using PRINT, use:
Using WITH NOWAIT forces the message to be displayed immediately and not just when the output buffer is flushed.
As a convention, I use @Debug = 1 for progress messages, @Debug = 2 to include dynmaic SQL, @Debug = 3 to output result sets.
Of course if you have GO batch terminators in your script the variable method won't work.
You need to simply comment out all your
PRINT
statementsSometimes the simplest solution is the best... Make all your print statements that deal with debugging as follows:
Then you can do a search and replace
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.)
Quite simply, no. There is no #debug either.
SSMS tools pack has a #debug feature but I've not used it.