Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp Files via SqL Command

Status
Not open for further replies.

azziuhc

Programmer
Apr 29, 2010
26
US
Ihave 2 files that are schedule to execute arouund mid day.
I need to find out how can I scheduleto FTP these 2 files within Sql jobs.
I have the following:
Set @FTP_Server = 'ftp://123.456.789.155'
Set @FTP_User = 'mylogin'
Set @FTP_PWD = 'mypass'
Set @FTP_Path = '/user/invoice_import/'
Set @FTP_FileName = 'ist.txt'
Set @FTP_SourcePath = '\\SAM\shared\Data Service Export\'
Set @FTP_SourceFile = 'Invoices_Feb 28 2011'
But I am stuck.

Please advice

Thank you
dre
 
I was able to use the T-SQL in the job agent:
exec master..xp_cmdshell 'ftp -s:c:\Temp\FTP_Files.bat'
It worked flawless
The batch file is listed below.
Hope it will help.


Where FTP_Files.bat:
REM -- open the FTP site
open 216.234.107.155
userLogin REM Your Login
userpassword REM Your password
REM lcd: change drive on your harddrive / Do not use map drives
lcd "\\networkdirve\filename"
REm cd: change drivewhere you want to put the file
cd /user_area/client_import
REM put: start uploading the file
put "filename"
REM close connection
bye
REM DOne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top