How are you adding a semi-colon to existing SQL code when upgrading?

  • Thanks. I would appreciate any feedback.

  • A combination of 1 and 4 for me. As we do necessary rework or upgrades of code, we add the semi-colons. If we miss some, we'll pick them up and manually correct them. I don't currently know of any tool guaranteed to do it correctly.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (3/18/2014)


    As we do necessary rework or upgrades of code, we add the semi-colons.

    This.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It's a pretty manual task because there's almost no way to determine precisely, programmatically, where to put the silly things. So I've always done what the others do. Put them on to all new code and modify existing code as I get to it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks for the feedback. You folks are three of the legends here on SQLServerCentral.com and in the SQL Server world, so hearing back from you in such a short time is an honor!

    - Chris

  • I'm trying to get use to put semicolons in my code, but I have to admit that most of the times I still don't put them. I remember to put them only when I have to because I'm using CTE, Merge statement, throw, etc.

    I don't believe that it will be enforced in the near future, because if that would be the case Microsoft will prevent so many upgrades.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • i've got SQL Enlight for SSMS, which is a static code reviewer, and it identifies all the missing semicolons , along with other best practices for SQL.

    it's not cheap at $145 dollars, but i figured i will be getting some use out of it.

    in this example, i right clicked on a database and chose to analyze with all rules; it scripts out all the objects, and builds a report, linking item to line number, as well as adding a blue squiggly to show the spot where it was missing:

    I've heard that SQLCop is a similar product, and free? but i never tried it out.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks, Lowell. Your post reminded me that Visual Studio 2012 (and 2013, I assume) has a rules engine built into it, as well. I wonder if it checks for the semi-colon?

    Thanks...Chris

Viewing 8 posts - 1 through 7 (of 7 total)

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