为什么我的本地临时表在 SQL Server 2008 中显示为无效对象名称,但在 R2 中却没有

Why do my local temporary tables display as invalid object names in SQL Server 2008 but not in R2

我正在将一些存储过程从 SQL Server 2008 R2 中的数据库移动到 SQL Server 2008(不是 R2)中的相同数据库。其中之一使用临时 tables。虽然从 R2 数据库生成的创建脚本执行正常,但临时 tables 和字段显示为无效对象名称。

这是一个简单的例子...

因此,在整个 SP 中,我都有一堆波浪形的红色下划线。 None 的临时 table 字段列在智能感知弹出窗口中。 R2数据库中不是这样

临时 table 必须有效,因为以下作品...

有什么办法可以让智能感知将临时 table 识别为有效的对象名称?

谢谢,

约翰

这似乎是 SQL Server 2008 pre-R2 中的错误。解释关于 Microsoft's support site 的错误报告:

Description

Even after doing a refresh of Intellisense, it still underlines red both the temp table names and fields that I have created.

收到以下回复:

Posted by Microsoft on 02/07/2011 at 09:53

Thanks for your feedback. This issue was fixed in the SQL Server 2008 R2 release.

不幸的是,您的答案似乎是,除了将目标数据库更新到 R2 之外,您无能为力。