Technical FAQs

Ask a Question

How to Execute a SQL Query Against a Specific Database

Issue
User needs to run a query against a SQL database

Product
Any product that uses SQL Server databases

Environment
SQL Server Management Studio (SSMS)

Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing any procedure.*
1) Open SQL Server Management Studio:
  -Start -> All Programs -> SQL Server X -> SQL Server Management Studio
OR
  - Start -> Search -> SSMS

2) Log onto the SQL instance you want to connect to using either windows authentication or SQL user authentication.
The user logged in must have the permissions to be able to perform the desired SQl query


3) Select File -> New -> Query with Current Connection

4) In the drop down, select the database that the query will be run against


5) In the query window paste/write the desired SQL query

6) Click the Execute button and observe the results panel.
Was this helpful?
What can we do to improve the information ?