之前通过论坛的高手帮助将指定位置的文本和里面的内容赋值到变量中,现在请问下各位如何将这个变量a和变量a替换另外一个位置内的test.sql文件中:
附上提取到变量的脚本:- @echo off
- set time=%date:~0,10%-%time:~0,2%%time:~3,2%%time:~6,2%
- pushd "c:\test\"
- for /f "delims=" %%a in ('dir /a-d /tw /o-d /b *.txt') do (
- set "a=%%~na"
- set /p b=<"%%a"
- move "%%a" "c:\testlog\%%a"%time%
- goto :Next
- )
- :Next
- echo,%a%&echo,%b%
- pause
复制代码 ----------------------------------------------------------------------------------
请问如何将上面提取到的变量a和变量b替换到C:\sql\test.sql中的指定位置:
1.1、如何将变量a赋值到红色部分的内容(变量a提取到的内容也是10位)
1.2、如何将变量b赋值到紫色的数字部分(变量b提取到的内容也是数字)
以下为C:\SQL\test.sql中的内容:
set echo on;
set time on;
set colsep |;
column spf new_value spf noprint;
select 'c:\log\'||to_char(sysdate,'YYYYMMDD-HH24MISS')||'.txt' spf from dual;
spool &spf;
COLUMN WO_ID JUSTIFY center;
COLUMN PLAN_QTY JUSTIFY center;
COLUMN WO_QTY JUSTIFY center;
COLUMN AUFNR JUSTIFY center;
COLUMN GAMNG JUSTIFY center;
COLUMN WO_ID FORMAT a10;
COLUMN WO_QTY FORMAT 9999999999;
COLUMN PLAN_QTY FORMAT 9999999999;
COLUMN AUFNR FORMAT a10;
COLUMN GAMNG FORMAT 9999999999999.999;
update table1 set qty=a_qty+51,b_qty=b_qty+51 where id='ABCDEFG12A';
update tablename set e_qty=e_qty+51 where d_id=(select c_id from table1 wm where _id='ABCDEFG12A');
spool off;
exit; |