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

  1. store teradata credentials in ~/.tdlogon file
  2. 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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -