"无效的对象名称"不管我叫什么名字

时间:2016-02-11 01:07:38

标签: sql sql-server tsql database-design

Finished

给出

  

无效的对象名称'已完成'。

就像我将MyDatabaseName.dbo.Finished更改为dbo.FinishedCREATE TABLE Finished ( partner_id UNIQUEIDENTIFIER, survey_id INT, PRIMARY KEY (partner_id,survey_id), FOREIGN KEY (partner_id) REFERENCES Partners(id), FOREIGN KEY (survey_id) REFERENCES Surveys(id) ); GO CREATE PROCEDURE CheckIfFinished @pid UNIQUEIDENTIFIER, @sid INT AS BEGIN SELECT COUNT(*) FROM Finished WHERE partner_id=@pid AND survey_id=@sid; END GO CREATE PROCEDURE UpdateFinishValue (@partner_id UNIQUEIDENTIFIER, @survey_id INT, @finished TINYINT) AS BEGIN IF (@finished = 1 AND NOT EXISTS (SELECT 1 FROM Finished WHERE Finished.partner_id=@partner_id AND Finished.survey_id=@survey_id)) INSERT INTO Finished (partner_id,survey_id) VALUES (@survey_id,@partner_id) ELSE DELETE FROM Finished WHERE partner_id=@partner_id AND survey_id=@survey_id END GO 一样。

没有任何意义。

完整的上下文是

tnStatus = [function or line of code that checks if Telnet is connected (w/o trying to open a connection), and returns boolean]
if(tnStatus == True):
    sendComand('bla')

1 个答案:

答案 0 :(得分:1)

DBMS无法找到此对象期间。

您可以使用以下简单查询检查表格:

select * from sys.sysobjects so
where so.name like N'%Finished%'
and so.xtype = N'U'

您问题的最常见原因是:

  • 您正在寻找错误的地方(服务器,数据库,架构......)
  • 您缺乏查找对象的权限。
  • 您遇到了区分大小写的排序规则问题。
  • 对象不存在(可能未创建或回滚)