Wednesday, December 22, 2010

Excute sql Script File From Bat File

In Most Of the Time We need to excute The Query and see the Result set ,but some Cutomers Don't allow to Login and see the Result ,At the Time We can Prepare bat File and Get the Result in Notepad File

Happy Coding

sample

step 1: Open NotePad File

step 2: Write The Following Content

SQLCMD -S .\SQLEXPRESS -i sqlFileName.sql >OutputtextboxName.txt

(This is For default Windows Authendication)

step 3:
Save as .bat File

Step 4:
Execute and test it..

No comments: