New toys in SQL Server 2012

  • Comments posted to this topic are about the item New toys in SQL Server 2012

  • Didn't realise you could do this! I've given some more examples here (and a link to creating custom snippets) and credited this article as my inspiration. Thanks.

    PS Code snippets sounded a great idea in VB and C#, but in practice I always forgot about them. Wonder if I'll remember in SQL?

    Andy is a director of Wise Owl[/url], a UK company providing training courses (and occasional consultancy) in SQL, Reporting Services, Integration Services and Analysis Services, as well as in many other Microsoft software applications. You can see more about Wise Owl's SQL Server training courses here[/url].

  • Thanks for posting the article, but I don't see any benefit to these options. Ctrl-t opens templates which are more useful than snippets and exist since 2005, and surround with option should have been integrated into intellisense.

  • While useful, it would have been even better, if MS had implemented as autocomplete feature. For example Type "BEGIN"<enter> and the word "END" would appear. Also enter "BEGIN TRY"<enter> and the END TRY and maybe "BEGIN CATCH" ... "END CATCH" would appear.

    This insert snippet behaviour could later be extended to include data validation checks (p[lus comments) and data sanitisation for standard data types, just to assist in improving the quality of the code being created

    Lastly, these days, all snippets should include error handling.

    By adding these features they would be emphasising the best practices thereby making developers opt out of writing the best code they could.

    Having said that, I'm aware it is possible to modify the templates that appear in Template Explorer so that you get your favourite features as you like.

    Tony S.

  • Do they have real code regions this time around? Would be nice to collapse a block of code.

  • Yep, that capability is there in SSMS 2012

    Tony S.

  • You've been able to click on + and - signs to expand/collapse code segments since SSMS 2008. I can't find any new feature for the equivalent of the #REGION / #END REGION tag in .NET.

    Andy is a director of Wise Owl[/url], a UK company providing training courses (and occasional consultancy) in SQL, Reporting Services, Integration Services and Analysis Services, as well as in many other Microsoft software applications. You can see more about Wise Owl's SQL Server training courses here[/url].

  • I'd be surprised to see #Region a la .NET in SSMS because the sql parser would have to be modified to handle that and for this I'd be surprised!

    Tony S.

  • I think it's fascinating how much value people put on such things as being able to type a 5 letter word like BEGIN and have the machine type a 3 letter word like END. I've also found that although things like Intellisense can be valuable, unless you can train it for certain things like NOT automatically replacing things like t.N, it actually slows me down more than it helps. The only thing I really like is the matching of braces and parenthesis. I don't even like auto indent because it just doesn't do what I need it to do when I need it to do it. 😉

    The idea that Intellisense doesn't actually help with the correct columnar information until you have a table in the FROM clause doesn't help much either. If would really be helpful if you could start typing FROM, do a selection, and then have it add the SELECT above it. Of course, I'd bitch about that if it weren't trainable, as well.

    I've seen some folks that have gotten really good at writing "stock" SQL with Intellisense. I guess that's my problem. I don't write much "stock" SQL. 😛

    --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)
    Intro to Tally Tables and Functions

  • I'm not sure why this article is getting such low marks. It exposes some information that a lot of people didn't know about and it does so in a helpful and straightforward manner. Don't penalize the author just because you don't find the MS feature that was written about to be helpful. I agree that the information comes up a little short compared to the title but it's still a good article on the subjects contained in the article.

    --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)
    Intro to Tally Tables and Functions

  • Jeff Moden (5/15/2012)


    I'm not sure why this article is getting such low marks.

    I would guess it may be because of the more sensationalized headline for the article. Also from a content perspective there is not a whole lot in there (I rated it average 3*).

    However, I still appreciate the author's effort to find time and write the article. And for that I am thankful.

    Ratings are overrated. 😛

  • What I can't believe is that MS included snippets for CURSORS!!! Egads, what have we been saying (Jeff Moden) for years? NO CURSORS!! OK, some cursors, but only when absolutely necessary, and it certainly should NOT be a default option in the snippets for cry'n out loud. And the 'Surround with' function includes While loops too? I actually ran into an 'Expert' last month who was so proud of himself for not using Cursors, and yet used while loops instead! RBAR!

  • So what ? This is like a TV programme in the UK called Dragons Den, where inventors come and pitch an idea. Sometimes you get people who invent something that tries to solve something that isn't actually a problem or a big deal. I don't really see the ability to add code snippets as being a great new toy.

    The emperor's new clothes ?

  • Dan Guzman - Not the MVP (5/15/2012)


    I actually ran into an 'Expert' last month who was so proud of himself for not using Cursors, and yet used while loops instead! RBAR!

    That's always a hoot! 😛 I've run into similar experts that think Recursive CTEs are even better replaceents... until I show them that While Loops usually beat them quite handily. :hehe: Of course, I always try to get them back to some form of decent set based method after that.

    --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)
    Intro to Tally Tables and Functions

  • Hmm... The features mentioned in the article are done or doable by SSMS Tools Pack (sql snippets)...

Viewing 15 posts - 1 through 15 (of 18 total)

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