Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

sqlcmd' is not recognized as an internal or external command

$
0
0
Am trying to run the below batch but I always get sqlcmd' is not recognized as an internal or external command,\roperable program or batch file . how to fix it please I have sql 2014 [code="plain"]@echo offset Instance=%1set DataBase=%2set Password=%3set userName=%4set path=%5set scripts=%path%\_scripts.txtif "%instance%" equ "" set instance=-"."if "%DataBase%" equ "" set DataBase=-"PracticeMaster"if "%Password%" equ "" set Password=-"123"if "%userName%" equ "" set userName=-"sa"remrem Make sure the scripts file exists.remif not exist %scripts% ( echo. echo Scripts file "%scripts%" does not exist. echo. goto error) remrem Clean output of any previous runsremif exist %path%\__tmp* del /q %~dp0\__tmp*remrem Apply all SQL scripts in order as listed in _scripts.txtremrem NOTE: if any of the script filenames contain a space, thisrem for loop will only see the 1st component of the filename,rem and then fail (file not found). Do not use spaces in therem script filename.remfor /f "delims==" %%x in (%scripts%) do ( echo. echo Applying script %path%\%%x... rem rem Make sure script exists rem if not exist "%path%\%%x" ( echo. echo ERROR: script does not exist '%path%\%%x' echo. goto error ) rem rem Run the script, show the output on stdout and tee this to a rem file with the same name as the script, prefixed with __tmp_ rem sqlcmd -S %instance% -U %userName% -P %Password% -i "%path%\%%x" -o "%path%\__tmp_%%x.txt") echo.echo Done!goto end:errorecho.endlocalexit /b 1:endendlocalexit /b 0[/code]

Viewing all articles
Browse latest Browse all 3145

Trending Articles