(I know this isn't really meant for here, but I can't ask questios on Stack Exchange)
I'm creating a batch file and I get this error message:
'sqlcmd' is not recognized as an internal or external command,
operable program or batch file.
I know why my code is wrong but don't know how to fix it.. I haven't got MYSQL and I'm not using Microsoft SQL server 2005, I'm using SQLyog and there is no sqlcmd, so what do I change my code to?
This is my code:
@echo off
cls
set /p SName=Server Name :
set /p UName=User Name : root
set /p Pwd=Password :
set /p DbName=Database Name : test
set /p choice=ARE YOU SURE TO EXECUTE SCRIPTS in %DbName% (y/n) ?
if '%choice%'=='y' goto begin
goto end
:begin
if exist _dataimport.txt del _dataimport.txt
@echo on
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i "UDDs"\UDDs.sql >> _dataimport.txt 2>&1
@notepad _dataimport.txt
:end
Best Answer
Assuming that you have properly installed your SQL softwares, if the command prompt returns with:
this means that your software is not probably placed into the folder defined by the
%PATH%
environment variable. With this latter it is possible to recall executable applications without defining their full path. Then, to solve this issue you can:.exe
file in you batch script.exe
file into the directory defined by%PATH%
You can see the list of the directories defined by this environment variable invoking the
set
command from the terminal or openingControl Panel > System > Advanced > Environment Variables