Will Terminators Be Required?

  • Like Jeff said, "just look at the MS provided system stored procedures."  For a quicker example right click on a table and pick either, "Select Top 1000" or "Script Table as". No semicolons are in the any of the generated scripts.  This just encourages one to NOT use semicolons. 
    - Dan Beggs

    Dan Beggs

  • This was a very useful and interesting article. I had never really considered how useful and sensible it is to use statement terminators as a matter of course. I will change my behaviour accordingly!
    @dan-2 Guzman.... thanks also for the very useful link.

  • They should have added a check to intellisense when they announced statement terminators were going to be compulsory. Instead of enforcing an explicit statement terminator which I see as merely an attempt to make code more readable, they could have a toggle icon like the one in Word which allows you to see the line breaks etc.

    MattF

  • I agree with you, Steve, I don't believe we'll ever see semicolons required in T-SQL. I've seen hundreds of T-SQL statements written by people, which are still running fine in their respective environments. Always still running even when those SQL Server instances get up upgraded to newer versions of SQL Server. I've seen some semicolons used, but I'd have to say its probably less than 10% of the code I've seen. I don't think Microsoft would want to stop so much T-SQL code by insisting semicolons are required in T-SQL code.

    Kindest Regards, Rod Connect with me on LinkedIn.

  • Dan Guzman-481633 - Monday, August 6, 2018 6:21 AM

    Although not using semi-colon statement terminators has been deprecated for a decade, using statement terminators is still the exception rather than the rule, even in new development. I'm rather particular about using semi-colon terminators myself event though I don't expect terminators to be a T-SQL requirement in my lifetime.

    A pet peeve of mine is seeing semi-colons used improperly, preceding a statement instead of terminating one, just to avoid a compile error. I personally don't think it's all that difficult to place the terminator in the proper place, terminating the previous statement. I wish the T-SQL parser was more strict in this regard and adhered to documented syntax.

    Not using terminators can introduce some nasty and unexpected behavior: https://www.dbdelta.com/always-use-semicolon-statement-terminators/

    --
    Dan
     

    Not using statement terminators has never been deprecated by MS, all they did was require that some of the new things they've added require the previous statement to have a terminator.  Which is hugely annoying and inconsistent.

  • I won't lie - when I saw this title I immediately thought about this:
    Image result for terminator

    Anyone else? 🙂 

    Anyways - for a long time now I have been zealously adding semicolons to code. My time working with Oracle instilled that practice. Now I even have SQL Prompt add them when I format code.

  • ZZartin - Monday, August 6, 2018 8:50 AM

    Not using statement terminators has never been deprecated by MS, all they did was require that some of the new things they've added require the previous statement to have a terminator.  Which is hugely annoying and inconsistent.

    Actually, not using statement terminators has been deprecated.  They just won't make it mandatory until they have fixed all their code first.

  • Jeff Mlakar - Monday, August 6, 2018 9:21 AM

    I won't lie - when I saw this title I immediately thought about this:
    Image result for terminator

    Anyone else? 🙂 

    Anyways - for a long time now I have been zealously adding semicolons to code. My time working with Oracle instilled that practice. Now I even have SQL Prompt add them when I format code.

    That came to mind, along with some developers that should be effectively terminated.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares - Monday, August 6, 2018 9:29 AM

    Jeff Mlakar - Monday, August 6, 2018 9:21 AM

    I won't lie - when I saw this title I immediately thought about this:

    That came to mind, along with some developers that should be effectively terminated.

    What came first to mind was SCSI and the joy of SCSI-voodoo. The last device on a SCSI chain has to be terminated.
    As for developers, well, I'll be generous today and say that we've all made mistakes.

  • Lynn Pettis - Monday, August 6, 2018 9:28 AM

    Actually, not using statement terminators has been deprecated.  They just won't make it mandatory until they have fixed all their code first.

    What I find silly about it is that MS didn't require terminators at the end of the new stuff they've been adding, only as terminators to the previous statement.

  • dsor - Monday, August 6, 2018 4:42 AM

    I expect we'll get a tool that puts the semicolons in place to upgrade old sql automatically. The remaining issue then would be any dynamic queries left, which in a reasonable database should be few enough to locate and fix in an afternoon.

    When you are talking about a project with multiple developers it is going to take many many afternoons.

    412-977-3526 call/text

  • ZZartin - Monday, August 6, 2018 10:14 AM

    What I find silly about it is that MS didn't require terminators at the end of the new stuff they've been adding, only as terminators to the previous statement.

    Actually, the MERGE statement is required to be terminated by a semicolon.
    Not sure about any other new stuff.

  • John Rees - Sunday, August 5, 2018 11:49 PM

    I think it's important that languages are allowed to evolve safely, otherwise the mistakes of our ancestors will forever burden us.  Look no further than \r\n or should I say \n, or even \r.  Seemingly insignificant decisions can have far reaching consequences, and they slow us all down.  Maybe each developer loses only 5 minutes a week thinking about line terminators, or semicolons, but that adds up to a lot for all of us, every year, forever!

    I think one small hope for language change is the slow, but relentless, adoption of devops.  These techniques push the idea that change can be managed more easily than before.  If we can make the test cycle less painful, then people will be able to cope with new releases without panic.

    Also, there has to be adequate warning, and easy ways to find problems before they occur. 

    ...

    Good points, and people have proposed solutions similar to what you did, but so far MS hasn't moved on.

  • Sean Redmond - Monday, August 6, 2018 3:21 AM

    I note that Microsoft don't just say, support will be withdrawn in the future, they give a specific roadmap as to until when what levels of support will be available. Something like this for upcoming and deprecated features would be welcomed.

    The problem here is always sales. When xx% of your revenue comes from large customers that don't want to review all code and make changes, it's hard to be fascist.

  • roger.plowman - Monday, August 6, 2018 7:08 AM

    I actually have started using semi-colons to terminate lines, but I have to say T/SQL syntax is a nightmare mish mash of 1960s era design that somehow escaped the Grim Reaper...much to everyone's sorrow.

    Yep

Viewing 15 posts - 16 through 30 (of 34 total)

You must be logged in to reply to this topic. Login to reply