我的 friend 向我发送了他在服务器 2008 中编写的命令,它们运行没有问题,但是我的副本和过去的命令在 2012 中不起作用。有什么原因吗?这是代码:
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);
这是错误:
Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword 'COMPUTE'.
最佳答案
COMPUTE
在 SQL Server 2012 中不再可用,这就是您收到该错误的原因。请参阅此页:
它说:
This topic describes the Database Engine features that are no longer available in SQL Server 2012:
*Transact-SQL syntax | COMPUTE / COMPUTE BY *
关于SQL 2008 VS 2012错误: Incorrect syntax near the keyword 'COMPUTE' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12491404/