I am new to Batch.
My code:
@ECHO OFF
SET colu=
SET sn=
SET /P colu= Enter column name:
SET /P sn= Enter ID :
sqlcmd -U USER -P PWORD -S SERVER -d DBNAME-i sqlSCRIPT.sql -o LOG.txt -v delete=%colu% d_id=%%I
pause
SET /P sn= Enter ID :
sqlcmd -U USER -P PWORD -S SERVER -d DBNAME-i sqlSCRIPT.sql -o LOG.txt -v delete=%colu% d_id=%%I
pause
SET /P sn= Enter ID :
sqlcmd -U USER -P PWORD -S SERVER -d DBNAME-i sqlSCRIPT.sql -o LOG.txt -v delete=%colu% d_id=%%I
The code works and does what I need it to do which is delete records from the db but I was hoping that there was a more efficient way to write it.
How would I implement a while loop in batch that will keep asking the user to enter the id until they press the end key? Also I realize that having pause in between sqlcmd is highly inconvenient.