SQL 2008 VS 2012 错误:关键字“COMPUTE"附近的语法不正确 [英] SQL 2008 VS 2012 Error: Incorrect syntax near the keyword 'COMPUTE'
问题描述
我的朋友向我发送了他在 server 2008 中编写的命令,它们运行没有问题,但是我的副本和过去在 2012 中不起作用.有什么原因吗?代码如下:
My friend sent me the commands that he wrote in server 2008 and they worked with no problems, mine however from a copy and past did not work with 2012. Is there any reason why? Here is the code:
Use Kudler_Database
SELECT AccountNumber, [Description], ShortDescription,Balance
FROM Chart_of_Accounts
ORDER BY left (AccountNumber, 2)
COMPUTE SUM(Balance) BY left (AccountNumber, 2)
COMPUTE SUM(Balance);
这里是错误:
消息 156,级别 15,状态 1,第 6 行 关键字附近的语法不正确'计算'.
Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword 'COMPUTE'.
推荐答案
COMPUTE
在 SQL Server 2012 中不再可用,这就是您收到该错误的原因.看到这个页面:
COMPUTE
is no longer available in SQL server 2012, thats why you are getting that error. See this page:
它说:
本主题描述了不再使用的数据库引擎功能在 SQL Server 2012 中可用:
This topic describes the Database Engine features that are no longer available in SQL Server 2012:
*Transact-SQL 语法 |COMPUTE/COMPUTE By *
这篇关于SQL 2008 VS 2012 错误:关键字“COMPUTE"附近的语法不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!