I have a master and a sub script as PowerShell Scripts. From the Sub powerShell Script, a SQL file is called. I am looking to pass in a variable to the SQL from Master Script through the sub Script. I can see it is coming to sub script but is not coming to SQL file.
Master Script has below;
Invoke-Command -ComputerName $server_temp -FilePath E:\PshellScripts\ErrorChecks_Sub.ps1 -argumentlist $batchname
Sub script has below;
$password = get-content E:\SQL\config\access.txt
$batch = $args[0]
& E:\Oracle\BIN\sqlplus.exe schema1/$password@env1 @E:\env1\SQL\Batch_Jobs_Error_Check.sql -Variable $batch
Batch_Jobs_Error_Check.sql has below;
set echo off
set echo off
set doc off
set pagesize 9999
set linesize 300
set feedback off
set verify off
set pause off
set flush off
set heading on
set newpage none
set termout off
set trimspool on
DEFINE batchname=&&1
spool E:\logs\Batch_Jobs_Details\Batch_Error.DTA;
select *
from batch_error where where batch_name like '&&batchname';
spool off;
exit
In the above sample, file name is hard coded. I would prefer if the filename can be dynamically assigned as theĀ &&batchname_error.dta
and How can i do it inside my website Custom Lithium Ion Battery Pack Manufacturer
Could you have a look and let me know please?
Thanks, Mary