Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    4

    Exclamation Unanswered: Invalid object name please help

    When i enter http://akor.alternatifim.com/
    i get the error below

    Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tblSARKICIM'.

    The SQL statement is so simple like

    Select * from tblSARKICIM

    However when i change the SQL statement Select * from lyric.tblSARKICIM

    lyric is username and owner of the tables.


    Problem is solved. I transfer the My SQL Server and then this problem occurs and i don't want change all my SQL statements.

    What can i do?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Going to need to see the code.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Can I ask, why does anyone feel the need to create database objects under any owner other than dbo?

    I've always seen it cause more trouble than it's worth.

    And if you want tables with the same name, why not just create another database?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Feb 2005
    Posts
    4
    I am running that SQL Server with hosting firm, and can not see user of dbo.
    What can i do for that? If administrators give Database Creators privilage to user lyric, is the problem solved? Or i need to change the owner of the tables to dbo?

    I don't think there is a wrong with the code, because it was running without problem before transfering db.

    Thanks for your helps.

  5. #5
    Join Date
    Mar 2003
    Location
    Bucharest, Romania
    Posts
    80

    If you don't even think to chage all your selects ...

    then the only work around is to instruct your web application (as I can see) to connect to the database server with that user (lyric) credentials.

    This is the way that SQLServer works: when you specify an incomplete object qulificator (eg. DBname.Owner.ObjectName), then SQL first tries with current db, and current user as a default. Then switch to dbo (in place of owner). If all tose failed, then an exception of "Invalid object name ..." is thrown.

    So if all your objects have the lyric user as their owner, you have two options to query them:

    First: select * from lyric.tbl1 (works for any authenticate user that has select permissions on that tbl1 table) or,

    Second: select * from tbl1 (works only if the current user is lyric)
    ionut
    Who cares about Romanian football ???

  6. #6
    Join Date
    Feb 2005
    Posts
    4
    Quote Originally Posted by ionut calin
    then the only work around is to instruct your web application (as I can see) to connect to the database server with that user (lyric) credentials.

    This is the way that SQLServer works: when you specify an incomplete object qulificator (eg. DBname.Owner.ObjectName), then SQL first tries with current db, and current user as a default. Then switch to dbo (in place of owner). If all tose failed, then an exception of "Invalid object name ..." is thrown.

    So if all your objects have the lyric user as their owner, you have two options to query them:

    First: select * from lyric.tbl1 (works for any authenticate user that has select permissions on that tbl1 table) or,

    Second: select * from tbl1 (works only if the current user is lyric)
    DB owner is lyric and if i perform the query with lyric.name_of_table it runs without any errors. However changing all query user_name.table_name will be very difficult for me.
    For that reason, i want to use query like select blah blah from tbl1 not lyric.tbl1

    Is there a way to determine and change the current user? Or i need to change the owner of the table. And What will be do if administrator give lyric to Database Creators privilage (Server Role)

    Thanks for your help

  7. #7
    Join Date
    Feb 2005
    Posts
    4
    I use that command and change the owner of the db lyric to dbo
    And it is working now, thanks for your help

    EXEC sp_changeobjectowner 'lyric.tblSARKICIM', 'dbo'

Posting Permissions

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