DBCC SHOWCONTIG is giving error for tables in different schema

  • Hello All

    When I am using the following query:

    DBCC SHOWCONTIG (HumanResources.department)

    I am getting the following error:

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near '.'.

    When I use:

    DBCC SHOWCONTIG (department)

    it gives:

    Msg 233, Level 20, State 0, Line 0

    A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

    Have logged in with Admin credential and the defrault schema for it is DBO.

    Please let me know how to execute the query by using schema.

  • You have to put double-quotes around the table name.

    DBCC SHOWCONTIG ("HumanResources.Employee");

    Or even better since DBCC SHOWCONTIG is deprecated, use sys.dm_db_index_physical_stats

    SELECT * FROM sys.dm_db_index_physical_stats(db_id(), object_id('HumanResources.Employee'), NULL, NULL , 'LIMITED');

    [font="Verdana"]Markus Bohse[/font]

  • Thanks Markus for your help

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

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