MS-SQL: Run a SQL Script on Database Server

Q. How do I execute a SQL script (.sql file) on my MS-SQL database server under Windows Sever 2003?

A. You can easily run any .sql file on MS-SQL database server using the Query Analyzer tool.

How can I execute a SQL script (.sql file) on my SQL Server ?

Open the Query Analyzer by visiting Start → Programs → MS SQL Server → Query Analyzer

Once opened, connect to the database that you are wish running the script on.

Next, open the SQL file using File → Open option. Select .sql file.

Once it is open, you can execute the file by pressing F5.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.