client - Teradata - run a file/script at Unix Linux command prompt -
i have client/ttu installed on unix box teradata.
if following, works. "..." teradata bteq normal output , once following done, i'm @ prompt.
$ bteq
...
....
. logon dbname/dbuser,dbpassword select date, time; .logoff; .quit;
..
...
$
now, lets put following lines in file called "testtd.bteq"
. logon dbname/dbuser,$dbpassword select date, time; .logoff; .quit;
what want ... how can run script (.bteq) @ unix $ prompt ???
i tried following methods far, didn't work, may im missing anything:
1. bteq < /path/to/testtd.bteq > testtd.log
2. bteq < .run /path/to/testtd.bteq
heredocendshere
any ideas? have provide ". logon dbname/dbuser,dbpassword" first, if i'm using heredocument way?
running bteq command on $ prompt doesn't give me help/options can use, other commands.
i.e. cmd -u user -p password -f file etc...
the best practice i'm aware of
- store teradata credentials in
~/.tdlogon
file - create script contains
bteq
call stuff needs.
e.g., create file bteqscript.sh
with
/* define helper variables, e.g.... */ export archivedir=~/data export datafile=dataoutput1.txt bteq <<eof .run file=$home/.tdlogon .export data file=${archivedir}|${datafile} /* sql code on next line(s) */ select 'foo' "bar" ; .export reset eof
note .run file=...
executes .logon command credentials, stored elsewhere.
kudos alex hasha bteq script.
Comments
Post a Comment