I am attempting to run the following query
sqlcmd -STEMP7 -E -devolive_base -w256
-QEXIT("DECLARE @r int EXEC @r = usp_AddToObservationtbl $,$,$ SELECT @r")
I am attempting to get the BAT file to ask the user for 3 variables.... can anyone help me ?
You can use set /p
to get variables:
set /p var1=Enter variable 1
set /p var2=Enter variable 2
set /p var3=Enter variable 3
...then use them in your command line:
sqlcmd -STEMP7 -E -devolive_base -w256 -QEXIT("DECLARE @r int EXEC @r = usp_AddToObservationtbl %var1%,%var2%,%var3% SELECT @r")
Bear in mind this still leaves you open to SQL Injection attacks or someone entering something destructive.