简体   繁体   English

查询适用于SQL Server 2008,但不适用于2014

[英]Query works on SQL Server 2008, but not in 2014

Why does the below query work in SQL Server 2008, but not in SQL Server 2014? 为什么以下查询在SQL Server 2008中有效,但在SQL Server 2014中无效?

SELECT sysobj.ects.* FROM sysobjects

Notice how the table name has the dot between sysobj and ects in the SELECT statement, but the FROM statement doesn't have the dot. 注意表名有着怎样的的sysobj学分之间的点SELECT语句,但该FROM语句没有点。 This happens with any table. 任何表都会发生这种情况。 You can put the dot anywhere in the table name and it will still run the query fine. 您可以将点放在表名称中的任何位置,它仍然可以很好地运行查询。

On 2014 you will see this error: 在2014年,您会看到此错误:

The column prefix 'sysobj.ects' does not match with a table name or alias name used in the query. 列前缀“ sysobj.ects”与查询中使用的表名或别名不匹配。

EDIT: Compatibility mode on the 2008 server is set to SQL Server 2000. 编辑:2008服务器上的兼容模式设置为SQL Server 2000。

It doesn't run for me in SQL Server 2008 R2. 它在SQL Server 2008 R2中无法为我运行。 I get the same error you say you are getting in 2014. I don't see how this can work for you. 我收到与您说的2014年相同的错误。我看不到如何为您工作。

Noel 诺埃尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM