SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Template Explorer - SS 2k8R2
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Cowski
Starting Member

USA
30 Posts

Posted - 10/09/2012 :  12:05:53  Show Profile  Send Cowski an ICQ Message  Reply with Quote
I've never really poked my nose in on the Template Explorer until recently and now I think this will be a new go to tool I'll use a lot..if I can figure it out.

The only thing I'm using it for, really, is to hold frequently used code in a semi-organized manner. Right now, I have a bunch of .sql code in a sub-folder with a shortcut on my desktop. Been working for a long time. But I like the idea of the Template Explorer a lot more.
The issue I've been having with creating my own templates, is the save. I create a Template for example. Double-click it & an open query window opens up. Cool, so far so good.
I put my custom code in.

What do I do now?

I mean, sure, I can save it as normal, drill down into my C:\users\blah-blah\deeper_we_go\ subfolder & save it there. 2 problems I have with that:

  • 1. That's silly to need to drill down like that to save it.

  • 2. Even when I do that, and I double click my new .sql code...it's not there.



I know I'm doing something wrong. I'm GUESSING I have to restart SSMS for that to take affect but I have about 25+ query windows going & don't want to go to the hassle of saving those (if needed) to restart to find out there was a simpler way to get my new code to populate when I double-click on it.

So what is this "simpler" way if it exists?

Thanks!

Cowski
Starting Member

USA
30 Posts

Posted - 10/09/2012 :  15:41:18  Show Profile  Send Cowski an ICQ Message  Reply with Quote
After much clicking around & little googlying here & there I found an answer to my question.

To those in the same boat as I, I'll explain how I got this to work the way I wanted. It's so simple I can't believe it.
(for training purposes I created a folder in the Template Explorer called 'Johns Templates')
1. R-Click on the folder you want to drop your template into and click on New -> Template. Name your template.
2. R-Click on your new template & maneuver to "Edit". A blank query window will open up in your SSMS. You'll notice the tab on this blank query window has the name of your template.
3. For simplicity sake I just hit CTRL+S to save it. You'll notice a asterisk next to your tab signifying that the file has not been saved yet. Once you save it, it will disappear. Also, you'll notice a yellow vertical bar to the left of your code. This will turn to GREEN when the code is saved. Something I didn't read about but figured out by clicking around and experimentation.

Now when you double click that code template, it will open up in a blank query window.

Also, if you decide to edit your code, any changes you make will show a small yellow vertical bar on the left of your code signifying that line has been changed. As in step #3 above, when you save your code, that yellow bar will turn to green.

Hope this helps out someone else. I'm onto experimenting now with the template parameters.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000