dbcc showcontig

  • Trying to run this

     

    declare @cmd varchar(512)

    select @cmd = 'USE Common DBCC SHOWCONTIG  ('+ '''AccountNoAndProductLine''' + ') WITH ALL_INDEXES, TABLERESULTS'

    print @cmd

    exec @cmd

     

    Results in this:

    USE Common DBCC SHOWCONTIG  ('AccountNoAndProductLine') WITH ALL_INDEXES, TABLERESULTS

    Server: Msg 2812, Level 16, State 62, Line 4

    Could not find stored procedure 'USE Common DBCC SHOWCONTIG  ('AccountNoAndProductLine') WITH ALL_INDEXES, TABLERESULTS'.

     

  • Unfortunately, you can't use "USE" statement in a batch execution. What you should do instead is split USE statment with rest of the batch.

    Something like this:

    USE COMMON

    GO

    NOW write all of your logic here.

    Hope this helps. BTW, there is a great article on BOL for DBCC SHowcontig. Please refer to that.

    -Nitin

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

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