By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 2,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Send/Receive text file using to some server using FTP

P: n/a
Hi All,

I have to write a stored procedure which will send/Receive text file
from/to a server by using FTP.

Is anybody have done anything on it? or know about it.
If yes, I would like to know about it. (also provide the stored
procedure code if possible)


Thanks in Adv.

T.S.Negi
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I have done this in the past using xp_cmdshell.

put simply.....

create procedure export_ftp_results
as
/* pre process the data into the output format - real table not a #tmp table
may be better*/
select output data into #tmp_table
where ......

xp_cmdshell('bcp output.txt out #tmp_table etc...)

xp_cmdshell('ftpexport.bat')

end
where ftpexport.cmd is a batch file that will call ftp with the right login
parameters etc.

likewise for import, ftp the data back then bcp in to a table and then do
any post data processing.
Regards

Chris Gadsby

"T.S.Negi" <ti********@mind-infotech.com> wrote in message
news:a1**************************@posting.google.c om...
Hi All,

I have to write a stored procedure which will send/Receive text file
from/to a server by using FTP.

Is anybody have done anything on it? or know about it.
If yes, I would like to know about it. (also provide the stored
procedure code if possible)


Thanks in Adv.

T.S.Negi

Jul 20 '05 #2

P: n/a
ti********@mind-infotech.com (T.S.Negi) wrote in message news:<a1**************************@posting.google. com>...
Hi All,

I have to write a stored procedure which will send/Receive text file
from/to a server by using FTP.

Is anybody have done anything on it? or know about it.
If yes, I would like to know about it. (also provide the stored
procedure code if possible)


Thanks in Adv.

T.S.Negi


You could use xp_cmdshell or the sp_OA% procedures, although there are
security issues with both those approaches. Instead, you might want to
consider doing this in a script outside the database (eg. VBScript,
Perl), and execute the script using a scheduled job. Finally, DTS has
an FTP task, but unfortunately it can only download a file, not upload
one, so I guess it wouldn't meet your requirements.

Simon
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.