Is there a way to get a script file that will be executing via SQLCMD to accept the parms passed in the SQLCMD call.. i.e. I need to input the DbName variable from the user. Below is the code I am using to automate an sql script file through cmd.
sqlcmd -S %SName% -U %UName% -P %Pwd% -v DbName="%DbName%" -i D:\SqlScripts\script.sql
Also in my sql script file I am using $(DbName) to receive the passed variable. But it's not working.