You can use sqlcmd to run a Transact-SQL script file. A Transact-SQL script file is a text file that can contain a combination of Transact-SQL statements, sqlcmdcommands, and scripting variables.
To run the script file
1.Open a command prompt window.
2.In the Command Prompt window, type:
sqlcmd -S myServer\instanceName -i C:\myScript.sql
3.Press ENTER.
More information, see http://technet.microsoft.com/en-us/library/ms170572.aspx