A way for one-click connect to remote SQL Server 2008 and execute T-SQL command

Posted on 2013-09-20
Medium Priority
Last Modified: 2013-09-24
Dear experts,

I just implement a complicated DB solution with SQL Server 2008, but it is not complated. So I need an tool or settings which allows me with 1 click to open a connection to remote SQL Server where I to execute T-SQL /with copy/paste - for example I modify a SP on my local DB and need to put it production DB/. Now I do this with MS SQL Server Management studio, but it require 3-5 clicks and navigation with Registered servers that I want to automaise as I expect OFTEN to do such operations. The ideal solution is to make a button in the Management Studio which directly open a remote SQL Server and even open a default Database, or Shortcut key but I found no such option. May be this could be provided with an external Adds-Ins?

I’m sure this is a common task for many colleagues. What is the best/fastes tool approach for such kind of operations?
Question by:dvplayltd
LVL 43

Expert Comment

by:Eugene Z
ID: 39511948
you can try to use the command line sqlcmd Utility to this

LVL 39

Accepted Solution

Aaron Tomosky earned 2000 total points
ID: 39512038

Author Comment

ID: 39512502
sqlcmd can do the job I ask, but not in good for me style. When I say update to DB - i mean update of 2-5 SP, not one text line and without visual interface it is not practical.

SSMS command line params look useful ... I'll give you the points or part of points if other useful answer come.

Is there a way in SSMS to make a shortcut to Registered server tab and to put it as button on toolbar. This will be 100 % a solution like I need, i look in SSMS but find no way.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

LVL 28

Expert Comment

by:Ryan McCauley
ID: 39516817
I'm not sure how often you expect to do this, or how many servers you'll be updated, and while it seems like you're just trying to avoid something annoying, I just wanted to offer up that creating and maintaining a solution in SSMS to avoid this issue might be more trouble than it's worth - if it only saves you a few clicks a month, it's not likely to work the effort.

That said, there are some options outside of SSMS that might fit your needs nicely - Powershell is one, can connect to however many servers you want (a list from a file, even) and execute your script, even collecting the results from all the servers on which it ran the script. Your time might be better spent learning how to use Powershell and writing a solution there.

Author Comment

ID: 39516984
To ryanmccauley

I'm with 15+ years in IT as both programmer and admin, the ask is because ALL the time I do such operations - for now with 2 Databases every day I do T-SQL change 5-10 times per day, but when Databases becoume 10 - you may calculate on your own how much click this mean. And worst-if I forget to apply ot one DB ...

PowerShell .. i take fast look, but it do now look like useful for me.

Author Closing Comment

ID: 39516988
10x. Until I found better solution, I'll use this. In fact, I already start useing it. Better solution - may be with Red Gate or other commercial tool.
LVL 28

Expert Comment

by:Ryan McCauley
ID: 39517678
I realize it's tedious - I wasn't trying to suggest that manual is better, and didn't realize the scope of your need. It's just the kind of task that I tend to see over-engineered to solve a very small problem - in your case, it sounds like it's common enough that it makes sense to have another solution.

Red-Gate does have a tool called "Multi-Script" that will execute the exact same script on multiple SQL Servers at once and return all the results in one place:


We've always used it to change our SA password globally or do collections of configuration data, and it works well for that - I suspect it would work for you too for what you're looking to do.

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question