connecting to sftp server from bteq script

Linux Operating System

connecting to sftp server from bteq script

I am executing the script from unix to connect to my sftp server and then to teradata database to export the table data in csv format to my sftp folder. Below is my script. 

 

test1.txt

.LOGMECH LDAP
.logon contoso.com/username,password123;
.OS DEL \\sftp_folder_files\sftp_test.csv
.EXPORT file \\sftp_folder_files\sftp_test.csv
.SET TITLEDASHES OFF

sel * from DBC.sftp_test;

.LOGOFF;
.QUIT;

 

 

script1.ksh

sftp username@abc.com << EOF
cd sftp_folder_files
put mytest.csv
bye
EOF

 

Now, I want to write my sftp connect in my bteq script itself to load the table data in csv format to my desired sftp folder. Please suggest