T-SQL WITH 分号问题

使用with 前面有sql语句时候
运行

with tempTbale(id) as (
select …..
)
select * from tempTbale

运行上面语句 提示下面错误

Incorrect syntax near the keyword ‘with’. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.

从stackoverflow找到解释,需要在with前加”;”,

;with tempTbale(id) as (
select …..
)
select * from tempTbale

链接如下:

Msg 319, Level 15, State 1, “Incorrect syntax near the keyword ‘with’.”

MSDN 定义如下

WITH common_table_expression (Transact-SQL).aspx “ WITH common_table_expression (Transact-SQL)”)