如果在2008年你使用2000兼容模式, 而存储的程序有旧式外在连接:
SELECT o.name, c.name
FROM sys.objects AS o, sys.columns AS c
WHERE o.[object_id] *= c.[object_id];
此语法在 SQL Server 2000 中有效, 但从那以后就已被折旧。 2005、 2005、 2008 和 2008 年, 如果您使用 80 兼容模式, 您可以在 R2 中用鞋挂号。 在 SQL Server 2012 中, 您不能再使用 80 compat 模式, 因此上述代码会失败 :
Msg 102, 15级, 州一级, 第1行, 3
靠近 的不正确的语法 。
2008年,你会得到这个错误信息:
Msg 4147, Level 15, State 1, Line 3
The query uses non-ANSI outer join
operators ("*=" or "=*"
). To run this query without modification,
please set the compatibility level for current database to 80, using
the SET COMPATIBILITY_LEVEL option of ALTER DATABASE. It is strongly
recommended to rewrite the query using ANSI outer join operators (LEFT
OUTER JOIN, RIGHT OUTER JOIN). In the future versions of SQL Server,
non-ANSI join operators will not be supported even in
backward-compatibility modes.
但如果您按照错误信息中的建议更改数据库, 将会有效 :
ALTER DATABASE foo SET COMPATIBILITY_LEVEL = 80;
这似乎有点过头了,但是如果没有真实的信息,我只能猜测一下。