Executing DBCC Commands via a SQL Job

  • We have SQL Server 2000 on Windows 2003. I need to set up a weekly job to Rebuild some indexes. I am thinking the best way to do this is the Create a New Job (new job step), select the Database, and add the following DBCC Commands in the Command Box. Is this correct? Do I really need the GO Statements?

    USE DBNAME

    GO

    DBCC DBREINDEX (TABLE1,'', 70)

    GO

    DBCC DBREINDEX (TABLE2,'', 70)

    GO

    DBCC DBREINDEX (TABLE3,'', 70)

    GO

    Thanks in advance, Kevin

  • That works.

    The gos aren't needed, they aren't a problem. Their batch-terminator statements, so each of those will be sent to SQL separately.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply