Cannot find object "[dbo].[Table_Name]"

  • I was testing running this in a query window: exec sp_msforeachtable 'alter index all on [?] rebuild'

    And I got the message : Cannot find the object "[dbo].[diskspace_hist]" because it does not exist or you do not have permissions.

    But it's right there along with all the other tables. I'm sysadmin and have no trouble working with any of the tables.

    What obvious thing am I missing this time ?

  • exec sp_msforeachtable 'alter index all on ? rebuild'

    works for me

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • I guess I'm wondering if there's some quirk about a particular table that could make it fail

  • homebrew01 (3/20/2009)


    I guess I'm wondering if there's some quirk about a particular table that could make it fail

    no quirk, you just dont need the []

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Yep, by putting in the [] in your query, you are looking for table name [dbo].[[dbo].[diskspace_hist]]

    not [dbo].[diskspace_hist]

  • [] was the problem .. thanks !

  • 😉

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 7 posts - 1 through 6 (of 6 total)

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