开发者

is it need to put ';' a semicolon in front of a CTE

is it need to put ';' a semicolon in front of a CTE? would any one h开发者_C百科ave that idea?

Thank you for the replays.........


Only if the previous statement does not end in ;

I don't personally because I use ; on the end of my statements.

When I answer here on SO, I do for clarity.

"WITH" itself can be used in many places so the ; is needed to enable the parser to determine the WITH context correctly (CTE link)

A contrived example: where is the statement delimiter?

ALTER DATABASE foo SET OFFLINE WITH ROLLBACK IMMEDIATE SELECT * FROM bar

ALTER DATABASE foo SET OFFLINE WITH MYCTE AS (SELECT * FROM bar) SELECT * FROM MYCTE

The same applies to DROP ASSEMBLY or EXECUTE or RECONFIGURE or MERGE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜