I have a sql file update_qde.sql
which contains the following code
UPDATE profile_const
set parameter_value = '04_2015'
where profile_name = 'MIDAS_MTH_ALL_Panels'
and parameter_name = 'PERIODS_TO';
commit;
quit;
I have another batch file test.bat
I want to pass the parameter_value as a variable from a batch file using batch command.
Could you please show me any way to do this?
Use SQLCMD variables, so change test.bat to call SQLCMD rather than ISQL
@echo off
sqlcmd -E -S myserver -i update_qde.sql -v PARM1=2015-01-01
Change the SQL to use the $() notation
UPDATE profile_const
SET parameter_value = '$(PARM1)'
WHERE profile_name = 'MIDAS_MTH_ALL_Panels'
AND parameter_name = 'PERIODS_TO';
COMMIT;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With