July 13, 2018 at 7:36 am
I like the next line when developing as well, since this makes it easy to add to the query and test things.
July 13, 2018 at 8:28 am
Steve Jones - SSC Editor - Friday, July 13, 2018 7:36 AMI like the next line when developing as well, since this makes it easy to add to the query and test things.
Same here. I leave them on the next line in production though. If it makes things easier for development it makes sense that it makes it easier for maintenance also. :Whistling:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
July 13, 2018 at 8:36 am
Sean Lange - Thursday, July 12, 2018 7:15 AMWas helping somebody just yesterday on another site and they couldn't for the life of them figure out why their view was throwing a syntax error. The view started with a cte that had a leading semicolon. They claimed they had been wrestling the thing for a couple of days. I used Lynn's terminology that the semicolon is not a beginninator, but a terminator. And once they removed the semicolon their view was just fine. I don't know why the coding style of starting a cte became to be but it causes so much confusion.
I know exactly the topic your talking about. And totally agree. i really dislike tutorials that teach the ;WITH syntax. It gives the completely wrong impression of what the semi colon is, and makes people think that it's called a ";with expression".
A little harsh, but if Microsoft ever enforce the deprecation, I'm really looking forward to hearing people start asking why code like the following isn't working :hehe:SELECT 'a' AS a
;WITH CTE AS(
SELECT 1 AS i)
SELECT i
FROM CTE
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
Viewing 3 posts - 31 through 32 (of 32 total)
You must be logged in to reply to this topic. Login to reply