English 中文(简体)
从 SQL 服务器2008 移动到 SQL 服务器2012 Express
原标题:Moving from SQL Server 2008 to SQL Server 2012 Express

我将一个应用程序从 SQL 服务器 2008 移动到 SQL 服务器 2012 Express, 但除了几个存储程序外, 都很好, 都说我有一个语法错误 。 我已经在网上查看, 还没有找到答案 — — SQL 服务器 2008 ( Standard) 支持的语法类型是否在 SQL 服务器 2008 ( Standard) 中支持, 但是在 SQL 服务器 2012 Express 中则不是?

最佳回答

如果在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;

这似乎有点过头了,但是如果没有真实的信息,我只能猜测一下。

问题回答

这里有 < a href=> http://msdn. microsoft.com/ en- us/library/ ms143729.aspx" rel= “nofollow” >list >list deprecated type of SQL Server 2012 - - - 特别是查看 T- SQL 区域。 您也可以使用 SSDT (SQL 服务器数据工具), 创建您 DB 的离线副本, 然后将版本设置为 SQL 服务器 2012 - 输出将显示许多版本之间的语法不兼容性 。 我写了一个有关 SSDD 的博客, 可能会帮助您 < a href=" http://lynnlangit. wlowesspress.com/2011/11/21/sql- server- 2012sql- server- data- tols/" rel=" nofol a> 。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签