#0218 – SQL Server-Get Help for DBCC commands using DBCC HELP


Database Consistency Check, abbreviated as DBCC commands are perhaps the best friends of any DBA. Following are some of the most common DBCC commands that can be found in almost all the script banks:



  1. CHECKDB
  2. CHECKIDENT
  3. CHECKALLOC
  4. CHECKTABLE
  5. TRACEON
  6. TRACEOFF
  7. SHOWCONTIG

I am poor at remembering the syntax of these commands and therefore take occasional help of the SQL Server Books On Line (BOL) to get a hint on the parameters that a particular DBCC command uses. However, there are cases when one is working directly off the development or quality assurance servers, which generally do not have BOL installed. In such cases, the easiest way to obtain help for the DBCC commands is to use another, obvious DBCC command – DBCC HELP!


Here’s a quick example:

DBCC HELP (‘CHECKIDENT’)
GO

Running the above returns the following text, which is essentially the syntax help for DBCC CHECKIDENT:


dbcc CHECKIDENT
(
    ‘table_name’
    [ , { NORESEED
        | { RESEED [ , new_reseed_value ] }
    } ]
)
    [ WITH NO_INFOMSGS ]


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


So the next time you are stuck with the syntax for a DBCC command, ask DBCC for HELP before reaching out for the BOL.


(The catch: To the best of my knowledge DBCC HELP only works for the documented DBCC commands, similar to the BOL.)


Until we meet next time,


Be courteous. Drive responsibly.

Advertisements

Let me know what you think about this post by leaving your feedback here!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s