To run the script file
- Open a command prompt window.
- In the Command Prompt window, type: sqlcmd -S myServer\instanceName -i C:\myScript.sql
- Press ENTER.
To save this output to a text file
- Open a command prompt window.
- In the Command Prompt window, type: sqlcmd -S myServer\instanceName -i C:\myScript.sql -o C:\EmpAdds.txt
- Press ENTER.
No output is returned in the Command Prompt window. Instead, the output is sent to the EmpAdds.txt file. You can verify this output by opening the EmpAdds.txt file.