invalid object

  • hi guys i'm constantly getting this error message when running a SP,

    Invalid object name 'dbo.Patient_Dem2'

    even though this object is spelt correctly and is in the database

     

    any thoughts?

    thx

  • Does the user that you're logged in as have permissions to that object?

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • What type of object is Patient_Dem2? Table or stored procedure?

    What do you get when you run the following query:

    SELECT t.uid

         , t.[name] As ObjName

         , u.[name] AS UserName

      FROM sysobjects t

      JOIN sysusers u ON t.uid = u.uid

     WHERE t.[name] = 'Patient_Dem2'

     

     

  • It probably exists as a different owner than dbo such as: mylogin.Patient_Dem2


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • From the error message, I appears that Patient_Dem2 is a table (or a table-valued user-defined function). Assuming a table, three things come to mind:

    1. The database context is wrong.

    2. The object was dropped.

    3. A bug in the stored procedure.

    The best way for others to help solve this is to post the code for the stored procedure.

    By the way, if you've figured this out on your own, please post a quick message here to let us know.

  • The error may also come from a trigger (assuming this may not be a select statement).

  • Hi,

    did you try to call 'dbo.[Patient_Dem2]' instead of 'dbo.Patient_Dem2' ?

    regards

    karl

    Best regards
    karl

  • thx guys i got this prob resolved

    thx much for the replies

  • What was the problem?

  • That's just not the way we do things here... lot's of folks busted a hump trying to help and now you're not going to take the time to explain what you did to fix the problem?  Where you gonna go the next time you need help?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • oops srry man been lots of demands here at work.

    I never used fully qualified name to reference the object Patient_Dem2, which was in another db.

     

    again srry guys

  • If you have more than one database on your server make sure that you are under the right database or use a fully qualified name in your proc.   To test it just

    type

    Use 'whatever the database name is your procedure uses'

    EXEC 'procedure name'

  • ok Jatinear, thx for the tip 

Viewing 13 posts - 1 through 12 (of 12 total)

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