sql server - Pass parameter value to sql file from batch file using batch command -


i have sql file update_qde.sql contains following code

update profile_const set parameter_value = '04_2015' profile_name = 'midas_mth_all_panels' , parameter_name = 'periods_to'; commit;  quit; 

i have batch file test.bat

i want pass parameter_value variable batch file using batch command.

could please show me way this?

use sqlcmd variables, change test.bat call sqlcmd rather isql

@echo off sqlcmd -e -s myserver -i update_qde.sql -v parm1=2015-01-01 

change sql use $() notation

update profile_const set parameter_value = '$(parm1)' profile_name = 'midas_mth_all_panels' , parameter_name = 'periods_to'; commit; 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -