Stored proc to import and archive files

General

Stored proc to import and archive files

Hey There,

 

I am a newbie to Teradata stored procs...

Can anyone point me to a sample script or how to develop a teradata stored procedure for this task -

loop thru a windows directory (dir is a parameter to the proc) for filenames and import multiple text files with same structured data to a teradata table, archive the files when done using 7zip...

 

I would highly appreciate if someone could forward me to sample scripts or documentation links in this regard.


Accepted Solutions
Junior Contributor

Re: Stored proc to import and archive files

A SQL Stored Procedure can't access a Windows directory (Teradata is a distributed DBMS running across multiple servers), but your description sounds like a task for TPT.

 

1 ACCEPTED SOLUTION
3 REPLIES
Junior Contributor

Re: Stored proc to import and archive files

A SQL Stored Procedure can't access a Windows directory (Teradata is a distributed DBMS running across multiple servers), but your description sounds like a task for TPT.

 

Re: Stored proc to import and archive files

Thanks a bunch DNoeth...

Got some idea with the sample scripts @ http://www.info.teradata.com/HTMLPubs/DB_TTU_13_10/index.html#page/Load_and_Unload_Utilities/B035_24...

Would you happen to know how to archive files in TPT with OS commands...

In SQL server the equivalent is to call xp_cmdshell proc that gives access to command line...Is there something equivalent in teradata...

 

For e.g.

 

set @sCmd= '"c:\Program Files\WinZip\wzzip.exe" -ex -m \\FileServerName\e$\Temp\FileName.zip \\FileServerName\e$\Temp\FileName.txt'
EXEC @iRetCode = master..xp_cmdshell @sCmd
IF @iRetCode <> 0
print('Error')

 

Thanks again..

Highlighted
Teradata Employee

Re: Stored proc to import and archive files

TPT has an "OS Command" operator.