So many times seen with
and, so many times SQL Server ask that with has ;
before it
How does ;with ...
work??
;with coords(...) as (
SELECT * ...
)
Why must have ;
before it?
The semicolon is used in SQL to end a query. Putting it before a query like that is just to make sure that the database understands that any previous query has ended.
Originally it was required after each query as they were entered line by line, so the database had to know when to run the query. When the entire query is sent in a single string, you only need semicolons in the case where the SQL syntax is not enough to determine where a query ends. As the with
keyword has different uses a semicolon is sometimes needed before it to make sure that it's not part of the previous query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With