Muzzle a DBCC command in SQL Server

by Grank December 08, 2008 11:16
Hey all,
 
If you write scripts that use any DBCC commands, and you find that it's too verbose, there's an hint WITH NO_INFOMSGS.  It surpresses all informational messages from any DBCC. 
 
You probably don't want to do this a lot, since if you're using DBCC you're probably doing something that you WANT information for, but I ran across it while writing a database clean script that uses DBCC CHECKIDENT.  I wanted to get rid of the verbose output you get:
 

Checking identity information: current identity value '1201', current column value '0'.

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

 
If you're doing that for several tables, it quickly fills up the output window, so any helpful information you're intentionally outputting is obscured.
 
I ditched it with:
 

DBCC CHECKIDENT([TableName], RESEED, 0) WITH NO_INFOMSGS

Tags: ,

Comments

Add comment


(Will show your Gravatar icon)

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen | Modified by Mooglegiant

About The Author

I'm a software developer and musician in Edmonton, AB.  I write mostly web-based software, primarily on the Microsoft stack.  I have an MCPD and several MCTS, but I've only been at this whole developer thing for a few years, and the truth is that I'm still learning more than knowing.  So these are my adventures and experiments and some of it will probably be blatantly wrong...  Just warning ya.