SQL SERVER – How to Execute the Query Without Using Management Studio?

One of my clients asked few interesting questions during my performance tuning consultation.  If you are interested, you can check more details here SQL Server Performance Tuning and Optimization. In this blog, we would discuss how to execute the query without SQL Server Management Studio (SSMS).

For those who are experts in SQL Server, the question sounds very funny but this blog is for those who are a newbie to SQL Server. Based on your level of understanding, you can proceed.

After hearing the question, I asked my client about the reason for this. They told that their security team asked to uninstall SQL Server Management Studio from Server and run query only from remote machines. Now, remote machines don’t have SSMS installed.

Solarwinds

WORKAROUND/SOLUTION

There are various solutions to this problem. If there is a need for UI based tool to do some basic tasks from UI and execute all kind of queries then SQL Server Operations Studio can be used. This tool can be used from Windows, Mac, and Linux machines. Here is the link to download the tool.

SQL SERVER - How to Execute the Query Without Using Management Studio? no-ssms-01-800x641

If there is no need for user interface and the command line is OK then we can use SQLCMD tool. This tool can be downloaded by searching “SQL Server feature pack” in any search engine. Here are the results as of today in google.

Based on your need, you can choose the version. I always go with the latest one because it can connect to old versions also. Once we go to download page, there are many downloads available. We need below two.

  1. Microsoft ODBC Drivers for Microsoft SQL Server (msodbcsql.msi)
  2. Microsoft Command Line Utilities for SQL Server (SqlCmdLnUtils.msi)

After downloading and installing above two (in the same sequence), you should be able to connect to local or remote SQL Server and execute queries using SQLCMD tool. You can read more about this tool here.

Hope this blog would help some newbie struggling to find the answer to simple question.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , , , ,
Previous Post
SQL SERVER – Patch Rule Failure: Not Clustered or the Cluster Service is Up and Online
Next Post
SQL SERVER – Why SQL Server Service is Stuck in Starting / Change Pending State?

Related Posts

Leave a Reply

Menu