Pass login name as a variable in a SQL Server script -
I have the following script that I want to produce people to use sqlcmd. I want to pass the name of the APP_POOL_USER as a variable for the script, because they want it like this, do not ask me why <$ P $ <($ APP_POOL_USER)] for $ [login] (APP_POOL_USER)] DEFAULT_SCHEMA = [Schema]
I get the following error when I code
message 15007, level 16, state1, line There is no valid login on '$ (APP_POOL_USER)' or you do not have permission.
How can this be done?
Edit:
This is a batch file currently executing I << p>
@ECHO OFF SET DB_SERVER_NAME = ". \ SQLEXPRESS" SEP APP_POOL_ACCOUNT = "ExUserAccout" sqlcmd.exe -E-S "% DB_SERVER_NAME%" -i "SQL_DB.sql" -o SQL_DB.log -v APP_POOL_USER = "% APP_POOL_ACCOUNT%"
The solution was in the batch file.
@ECHO OFF SET DB_SERVER_NAME =. \ SQLEXPRESS SET APP_POOL_ACCOUNT = ExUserAccout
Do not leave spaces between the equal sign and the variable name and value.
Comments
Post a Comment