无效的对象名称 sql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24621007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Invalid Object Name sql
提问by user3814197
I keep getting an invalid object name error on my sql code. (member_number, subscriber_policy_number
) is underlined with the error message.
我的 sql 代码中不断出现无效的对象名称错误。( member_number, subscriber_policy_number
) 带有错误消息下划线。
The code itself runs fine with no errors, why does this happen? None of the code above this is highlighted
代码本身运行良好,没有错误,为什么会发生这种情况?上面的代码都没有突出显示
update smmdmm.aid_data
set Member_Number = Subscriber_Policy_Number
where Member_Number in ('000000000','000000001')
回答by Sev09
Make sure you're using the correct database. It may be defaulting to the "Master" database, and it doesn't look like you have the full schema for the referenced table.
确保您使用的是正确的数据库。它可能默认为“主”数据库,并且看起来您没有引用表的完整架构。
Ex: [DatabaseName].[Schema].[TableName]
or [Database1].[smmdmm].[aid_data]
例如: [DatabaseName].[Schema].[TableName]
或[Database1].[smmdmm].[aid_data]
Hope this helps.
希望这可以帮助。
回答by Revanth Kumar
Try:
尝试:
Edit -> IntelliSense -> Refresh Local Cache
回答by kamil.ka
According to the error you're receiving I assume that you're using MSSQL.
根据您收到的错误,我假设您使用的是 MSSQL。
at the beginning of your queries try:
在您的查询开始时尝试:
use [YOUR_DATABASE_NAME];
and then your query. It helped in my case.
然后是您的查询。它对我有帮助。
回答by GSK
There might be 2 reasons for it.
可能有2个原因。
Table name is wrong
Sol: Verify the table name and try to execute
Database name and schema name are not mentioned with the table name in query
Sol: Mention the database and schema name in SQL query.
表名错误
Sol:验证表名并尝试执行
查询中的表名未提及数据库名称和模式名称
Sol:在 SQL 查询中提及数据库和模式名称。
For ex:
例如:
select * from MESQLDBM.dbo.Alert ([DatabaseName].[Schema].[TableName])
回答by hoogw
This works for me : Edit -> IntelliSense -> Refresh Local Cache
这对我有用:编辑 -> IntelliSense -> 刷新本地缓存
回答by Daniel
In my case, I was missing modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
就我而言,我失踪了 modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
回答by Pixel17
I came to this page as I kept getting this error each time I ran the program, anyway I found that in the settings my SQL string table name was missing the underscore and should have been as follows; tbl_Customer.
我来到这个页面是因为每次运行程序时我都会收到这个错误,无论如何我发现在设置中我的 SQL 字符串表名缺少下划线,应该如下;tbl_客户。
回答by Md. Zakir Hossain
I faced case sensitivity problem. Below was my erroneous query
我遇到了区分大小写的问题。下面是我的错误查询
SELECT * FROM [bccci$Biochemical View] AS ibv
here "V"
- 1st character of last part of table name is Upper case but in actual table name it was lower case. that is [bccci$Biochemical view]
. So my correct code was
这里"V"
- 表名最后一部分的第一个字符是大写,但在实际表名中它是小写。那就是[bccci$Biochemical view]
。所以我的正确代码是
SELECT * FROM [bccci$Biochemical view] AS ibv
回答by Phil50
It happened to me in a function and it was a table within that had been dropped long time ago
它发生在我的一个函数中,它是一个很久以前被删除的表