Home Forums SQL Server 2005 Administering 'DBCC' is not recognized as an internal or external command RE: 'DBCC' is not recognized as an internal or external command

  • SQL Server is a service that runs like any other service under the OS. In order to issue commands or SQL statements to the server, you have to connect to the server and send those commands or statements to the server to execute them on your behalf. You can get a connection to the running SQL Server service in several ways. You can connect with SQL Server Management Studio, a graphical user interface for administration and development. You can use several command line utilities, like OSQL or SQLCMD that can be executed as OS level commands but which can take in script files with SQL statements and execute then in 'batch' mode. So in your case (based on what I've seen so far), you'd create a text file with the DBCC commands in it (let's call it dbcc.sql) and then issue something like the following at the OS command prompt (or in a batch file):

    SQLCMD -Sservername -Uuserid -Ppassword -idbcc.sql -ooutput.txt

    This is basic syntax and there are several options ( you might use -E and remove the -U and -P if you are using windows authentication) that you need to choose. The above syntax will read in the dbcc.sql and execute those at the server and write out the results to the output.txt file for later examination.


    And then again, I might be wrong ...
    David Webb