Using Code Snippets in SSMS

  • Comments posted to this topic are about the item Using Code Snippets in SSMS

    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
  • Very useful reference Luis, thank you!

    😎

  • Thanks for this! I'm one of those guys who has a folder(s) with all the useful SQL snippets but when I need it, I usually forgot where I put them...

    Having the Snippets in SSMS is just great and logical at the same time.:-)

  • Are there any examples for creating an MDX Snippet?

  • Here's a tool called Snippets Generator[/url] that I've been using that allows you to past the SQL and generate the snippet.

  • I have been looking for/wanting these in SSMS since I started using it, we have had such things in Homesite forever. Glad to hear it will be in 2012, can't wait till I upgrade.

  • SQLvis (4/7/2016)


    Are there any examples for creating an MDX Snippet?

    I'm sorry. SSMS still doesn't support snippets for MDX queries.

    I'm not sure if Visual Studio has that capability.

    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
  • cstringham (4/7/2016)


    Here's a tool called Snippets Generator[/url] that I've been using that allows you to past the SQL and generate the snippet.

    It's nice, but it's still missing the use of literals. That's a great functionality that would make this tool perfect.

    Thank you for sharing. 😉

    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
  • john.w.walker (4/7/2016)


    I have been looking for/wanting these in SSMS since I started using it, we have had such things in Homesite forever. Glad to hear it will be in 2012, can't wait till I upgrade.

    You could update SSMS without updating your servers. Just saying 🙂

    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
  • Thanks for the good article.

  • Great article Luis. I have learned something new today. I never played around with snippets but have a dozen ideas how they can make life easier.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • SQLvis (4/7/2016)


    Are there any examples for creating an MDX Snippet?

    That was my first thought. 😉

    You just have templates. I just found this article: http://byobi.com/blog/2013/04/ssms-templates-for-ssas-developers/[/url]

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • I once did that and tried using a newer version of SSMS with an older database. You sure I can use SSMS 12 with SQL Server 2008 R2 databases with no problems? I am stuck on 2008 until we can upgrade Microsoft Dynamics Navision - which I hope to get approved for next year.

  • You can definitely do so. I use SSMS 2014 and all of our instances are 2014 except one that is an old 2000 instance and it works fine.

    This of course also worked with SSMS 2005 through 2012 too.

  • Thanks for the information, very useful.

    I also propose the use of this (external) tool, specifically designed to share the snippets among colleagues and team members: https://www.snip2code.com. It also comes with an handy plugin for Visual Studio, if needed.

    All my scripts are stored there and I can easily reach them even when I'm in RDP on the servers of my customers who don't let me connect to the server from my local Management Studio...

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

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