Invalid object name

  • We originally set up our database so that some of the tables were owned by dbo and the rest by another user (call it SYS/username for this example). All was fine and I wrote several views and stored procedures. When I learned enough to know that they should all be dbo, I had the administrator change all the tables to be owned by dbo. Now all SPROCS , tables, and views are owned by dbo. Good. Now any time I try to run anything (SPROC or view) I always get a variation on this error (it only changes by the name of the object I tried to execute/access)…

    [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name ‘SYS\username.tbl0010CallDetail’.

    I had removed all traces of SYS\username references in the code of the objects but it is still imbedded.

    Is there an easy way to tell SQL Server to rebuild using the new code so that the SYS\username references go away? Is it possible that the SPROC is not being run by dbo but actually SYS\username when run out of Query Analyzer (the name of all SPROCS are qualified with [dbo]).

    Help!

  • Possibly your stored procedures are still in cache. You might try SP_RECOMPILE on all SP. Seems like there is an easy way flush all execution plans from cache, but I just can't recall how to do that right now.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • also add in all the procedures the dbo. when calling to any object.

    For example:

    SELECT * FROM dbo.TableName

    EXEC dbo.spname

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

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