Wednesday 30 June 2021

Execute SQL files using command prompt

 Using SQLCMD command we can execute the sql file and we can store the execution result in the file.

Below is the file.  

This will return the result set. We will store this result set into the other files.  

Opening the command prompt and writing the below command.

SQLCMD -E -S BAGESH\BAGESHDB -d AdventureWorksDW2017 -i J:\code\DimProduct.sql -o J:\code\DimProduct_resultset.txt

   

CMD prompt   

After run.

See the result.  

Get the expected result.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts