How do I open .sql file?

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.
For More Information Please Refer:
https://stackoverflow.com/questions/7828060/how-do-i-import-a-sql-data-file-into-sql-server
You May Also Like to Read: