Open multiple copies of same file in SSMS - sql-server

We have a script file called CreateClientDatabase.SQL, double clicking it opens it in SSMS where we can change a few parameters and execute it.
Problem:
A few hours/days later we may need to do the same again for another client, but if the original tab in SSMS has not been closed then double clicking the file will simply bring that tab to the fore and not actually open the file.
So it's easy to assume the script you are now looking at is the same as the file when it is not, and this can lead to all sorts of issues.
Is there a way round this?
Can SSMS open a second copy of the file, or warn the user that it hasn't actually opened it much like Excel does.

What you need, I think, is something similar to excel or word template files: whenever you open such file by double-click, a new document with the contents of the template is created.
SSMSBoost add-in (that I develop) has “Autoreplacements” feature: you can define a “magic token”, that will be replaced by your script, whenever that token is typed. For example, we have pre-defined token “sel”, which is replaced by “select * from” whenever you type “sel” and press space.
You could associate your script with any word, like “doit”, so whenever you visit next customer, you just open new query window, type that word+space and you have your script in the window immediately.
Just to mention: SSMSBoost allows you to define “favorite” connections, so, you can save all your cutomer’s servers in one list and quickly switch between them.
Alternative:
Have a look at SSMS Templates (View->Template explorer). SSMS allows creating your own templates and opening them by double-clicking their name from Template Explorer. In connection with SSMSBoost “Preferred connections” list you have a good setup to start your work quickly.
Hope this helps.

If file is opened from the windows explorer then it opens another instance of SSMS.

I think what you need is to detect when the SQL script file is changed outside if the SSMS environment:
make sure that Tools -> Options -> Environment -> Documents -> Detect when file is changed outside the environment is checked.
More details can be found here.

Related

Multiple Similar (Duplicate) Reports

I currently created a report that I would like to duplicate 40 times but with a different filter each time. So far I'm afraid this is only possible with a very manual process but I was hoping if someone has a faster solution?
Would it be possible to connect to the DataStudio API (if there is one) and run a script for this?
Also, making a design change can be problematic as it needs to be copied to 40 reports. Does anyone have a suggestion for this?
A report is stored as an RDL file in the file system. Its of XML format. Make a copy of the file in the file system and open the copy using a text editor (I prefer notepad++) and find the parameter. Change the paramater to whatever value you want it to be and save the file under a different name. I would include the parameter name in the report name. If the report as using 'Memphis' I would name the report Sales_Memphis.RDL.
Do this 40 times. Be very careful about not changing the structure of the XML file (Don't change any of the element names or opening and closing symbols(<>). Re-import the file into SSDT report project to verify it is using the correct value.
To import a file into an existing project:
Right click on “Reports” folder and select “Add” then “Existing Item”
Now file browser window will open.
Find the file and double click on it.
Ideally you can have a dropdown with all the possible values for users to choose from but I guess that is not appropriate for your needs.
If this is a good solution please check it off as valid solution.
I checked this with google support and apparently there is no way yet to do this.
There are currently no API's available to do this nor can you download something similar to an RDL file. Right now the only way is manual duplication and to make adjustments for each report separately.
Have you looked into custom bookmarking. It sounds like it might be able to address the problem you're expressing. This way you would only have one report, but the links you would share would automatically apply the correct filter value.

Is there a way to disable the "Save" option on a downloadable file, and only allow the "Open/Run" option?

I have an InfoPath form that sits on my SharePoint site. When the file is clicked in the SharePoint directory, the user is usually given the option to Save or Open the file (sometimes dependent on the browser). Saving the file is frowned upon because I want to ensure that the user is using the latest version of the InfoPath form from the SharePoint location.
In a general web sense, is there a way to disallow a user (or at least attempt to prevent a user) from saving the file, and only opening it? I'm not talking about automatically downloading the file when they click it, as I know this is a security problem, and the reason why the open/save prompt exists in the first place. But can a prompt that only allows them to "Open" a downloaded file be shown instead?
And if not in a general web sense, can this be accomplished somehow using SharePoint black magic? I know that single-clicking a file in SharePoint (depending on the list or directory you're looking at) can sometimes result in that file just being opened in its native application without any prompt to the user whatsoever.
hmmm, I'm not sure if this will help but try creating a hyperlink to your form using this format:
https://sharepoint/YourSite/_layouts/FormServer.aspx?XsnLocation=https:sharepoint/YourSite/YourLibrary/Forms/template.xsn&Source=https://sharepoint/YourSite&DefaultItemOpen=1
This will open the form without the open/save dialog box

How to get logs into the Tool Log in Release Management for Visual Studio

In the Release Management for Visual Studio Deployment log, which can be found under the Details button found when viewing the details of a release, there are a number of columns.
The last three of these are Tool Log, Command Output and Status.
I have never seen anything in Tool Log, but I am in the situation now where I have a component running tests using vstest.console.exe.
Under "Command Output", I see the output from this program as it appears in the console window. However, vstest.console.exe can also be instructed to create a test log (a .trx file), which I would like to view under Tool Log. But I have no idea how to make this happen.
How do I get a log to appear under the Tool Log column?
The answer, it seems, is to set the "Log File Name" in the Tool definition to whatever log file you wish to view (in my case, the .trx file).
This obviously requires that you are using a tool that defines this, or a custom one. Fortunately, I'm using a custom tool.
Your Tool have to copy/create the .trx file to/in the Tool's work directory (%LOCALAPPDATA%\Temp\RM\T\RM\\).
Don't forget to add .trx extesion to Administration -> Settings -> Approved File Extension List.

Sql Server Mgmt Studio: is there a way to get it to reuse windows?

This is more an annoyance than a real problem, but it would be great if someone had a trick to get it to work.
Let's say I have a .Sql file, MyScript.Sql. If I go to the file location in Windows Explorer and double click it, it opens SSMS. Good, that's what I want. However if I double click on that file again (or a different .sql file), I get a new instance of SSMS. So regardless of whether the file is already open I get a new instance of SSMS. If I open a different file, it doesn't reuse the first instance of SSMS, it opens a new one. Basically any .Sql file will open an entirely new instance of SSMS. This seems very dumb. Is it broken and gonna stay that way? Is there a solution?
I've tried the solution on social.msdn but it didn't work. Basically it looks like I can get re-use but only if I use VS to open the file. Which isn't great because there are lots of reasons I prefer to edit sql in SSMS.
I'd be open to writing some sort of little intermediary app that takes in a file name, finds an existing ssms process and tells that app to open the file. If such a thing is even possible.
One instance of SSMS can't open two instances of the same file. Something to do with file handles I assume. So even your little intermediary app solution won't "fix" this. Why do you want to open the same file multiple times? If it's already open, how are you going to consolidate changes in both instances? If the goal is to save one copy as a different file, then just save the first file with a different name, then SSMS will treat the existing file as a "different" file. At least I think so; not at a PC where I can check.

How can I make the Tab Drop Down In Sql Server Management Studio display more of the File Names

Am I the only person annoyed by this? I don't even know what proc I'm clicking on if the file names have the same prefix, or are longer than the context window width.
I find the tab dropdown, as well as the tab names themselves, annoying. You can't widen either of them.
It helps to save each script to a file, even if only temporarily. I work in an environment where I need to save each script I write. I can see the file names if I hover over each tab. Not perfect, but it helps.
If you're running SSMS 2008 (or even just SSMS Express 2008), you can change certain property settings so that only certain things are shown in each tab: the current server, the current database, the filename, etc. If you only work in a single database, for instance, you could switch off everything except the filename.
But unless any of these suggestions help, there's really no way around those stupid tabs.
connect is garbage, they dont do anything
There isn't a way to make it any bigger.
I find this greatly annoying as well. There are a couple of connect items open about this.

Resources