Batch Script With SQLCMD Usage
Posted
by
user52128
on Server Fault
See other posts from Server Fault
or by user52128
Published on 2010-08-24T01:13:45Z
Indexed on
2011/01/05
15:55 UTC
Read the original article
Hit count: 253
batch-file
Hi All I am Writing a Batch Script Which has to read a set of SQL Files which exists in a Folder then Execute Them Using SQLCMD utiliy.
When I am Trying to execute it does not create any output file. I am not sure where I am wrong and I am not sure how to debug the script. Can someone help me out with script?
@echo off
FOR %F IN (C:\SQLCMD\*.SQL) DO sqlcmd -S LENOVO-C00 -U yam -P yam!@ -i %F -o C:\SEL.txt -p -b
IF NOT [%ERRORLEVEL%] ==[0] goto get_Error
:Success
echo Finished Succesffuly
exit /B 0
goto end
:get_error
echo step Failed
exit /B 40
:end
© Server Fault or respective owner