开发者

sql server 2005 express - Invalid Object Name error

开发者 https://www.devze.com 2022-12-25 15:38 出处:网络
I have a copy of a query开发者_开发问答 from a view (by filtering) and when i tried to excute it, it throws an error message that says \"invalid object name \'bla bla\'\".

I have a copy of a query开发者_开发问答 from a view (by filtering) and when i tried to excute it, it throws an error message that says "invalid object name 'bla bla'".

How can i fix it?

I am using windows 7(ultimate) os and sql server 2005 express.


You may be executing the query in the wrong database. If you are running it manually in SSMS, use the 'use' statement or the 'available databases' drop down list to select the correct db.

Or fully qualify the name of the object you are accessing (db_name.owner.object_name).

Or, as rlb.usa suggests, maybe the object just doesn't exist. (check your spelling...)


It can happen two ways:

  • You have table, procedure, or function name(s) that do not exist.

You can fix this by verifying the object does indeed exist. Check this one first. Is the spelling correct? Is the schema correct? (dbo.mytable != user.mytable)

  • SQL wants you to use "qualified" names.

You can fix this by putting use mydatabasename; at the top of your query, before the query itself. If it doesn't like that one, you can then try the longer method of using qualified names by prefixing all of your tables, functions, and procedures as databasename.schema.object .

0

精彩评论

暂无评论...
验证码 换一张
取 消