Results 1 to 2 of 2

Thread: sp_MSforeachdb

  1. #1
    Join Date
    Apr 2003
    Location
    Bethlehem, PA
    Posts
    2

    Question Unanswered: sp_MSforeachdb

    The below code uses sp_MSforeachtable to perform DBCC SHOWCONTIG on every table in a database. Is there a way for me to combine this code with sp_MSforeachdb so that ever table on every database on a 7.0 SQL Server has the DBCC SHOWCONTIG performed on it?

    exec sp_MSforeachtable 'declare @id int select @id = object_id(''?'')
    dbcc showcontig(@id) print '''''

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    I'd tried with no success, you should go with SP_MSforeachTable
    I will update once found any information.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •