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
精彩评论