batch file - Calling bteq from Powershell -
i generate bat file contains multiple bteq calls execute .btq script against teradata box, below example cmd call:
bteq <bteq\"file_1.btq" >>bteq_output.txt 2>&1
the syntax far understand is:
> specifies input file & >> specifies output file
i trying convert bat implementation powershell version stuck following issue:
ps c:\...\deploy.ps1:21 char:81 + ... -object { bteq < (join-path $deploydir $_) >> bteq_log.txt } + ~ '<' operator reserved future use. + categoryinfo : parsererror: (:) [],parentcontainserrorrecordexception + fullyqualifiederrorid : redirectionnotsupported
which result of call in powershell script:
(get-content -path $configfile) | select-object -skip 1 | foreach-object { bteq.exe < (join-path $deploydir $_) >> bteq_output.txt }
it seems bteq command line syntax directly conflicts < operator in powershell.
edit if try escape < ` instead presented following error, though parameter not picked up:
bteq.exe : *** warning: must log on before sending sql requests. @ c:\...\deploy.ps1:20 char:76 + (get-content -path $configfile) | select-object -skip 1 | foreach-object { bteq. ... + ~~~~~ + categoryinfo : notspecified: ( *** warning: y... sql requests. :string) [], remoteexception + fullyqualifiederrorid : nativecommanderror
anyone able shed light how 1 call bteq command in powershell when specifying file used?
in powershell try cat <your-bteq-file> | bteq
call bteq file
Comments
Post a Comment