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.
Author: Marcelo Ruiz
Marcelo has been working as a software developer for more than 15 years. He has participated in projects for companies in USA, Mexico, Argentina, Europe and Africa. He is skilled with Microsoft technologies such as ASP.NET, MVC, C#, WCF and SQL Server, among others.