报的错误是Msg 319, Level 15, State 1, Line 21 Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
WITH t AS ( select * from (SELECT ROW_NUMBER() OVER (ORDER BY EndDate DESC) as NewRowIndex,DateIndex FROM @tbDate ) a) UPDATE t SET DateIndex = NewRowIndex-1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
( select * from (SELECT ROW_NUMBER() OVER (ORDER BY EndDate DESC) as NewRowIndex,DateIndex FROM @tbDate ) a)
UPDATE t SET DateIndex = NewRowIndex-1
如果将 CTE 用在属于批处理的一部分的语句中,那么在它之前的语句必须以分号结尾。
多半是楼主弄错了, 联机帮助上明确写了的
可比较一下 @@VERSION 的结果, 不太可能是设置问题
现在就是这样的。之前出过几次这样的问题,我的SQL语句能用,发到美国去就报错。