ramlicious Blogs by Tina & Prabhu

May 25, 2010

ExecSQL.bat that uses osql utility

Filed under: SQL Server — Prabhuram @ 4:10 am

Here is another easy batch file, which makes use of osql utility to execute a SQL file and to generate an output log file.

Syntax:

\>ExecSQL.bat [input sql file]

Sample:

The above command generates an output file called input.sql.log in the patch where the input file resides. Change the contents of the batch file (ExecSQL.bat) when required:

@echo off
osql    -S (local)    -E     -d master    -n    -i %1    -o %1.log
ECHO Process Completed
pause

I'm writing this just for me so that I can refer to this whenever necessary.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress