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!

Export .txt then Save File to FTP Site 1

Status
Not open for further replies.

stsuing

Programmer
Aug 22, 2001
596
0
0
US
I know how to create an ascii file out of SQL Server to the hard disk, but what is the best way to then save it to an FTP site. I need to login using a user name and password.

I tried setting up the FTP site as a network place, but the DTS wizard wouldn't write to the site.

Thanks
 
This has not been tested, and you will probably need some sort of admin rights on the SQL server to perform this (right to xp_cmdshell for instance)

Create a file on the server called c:\ftp_command.txt, in this file write the commands for the ftp session. ie
===
open ftpservername_to_connect_to
user
username
password
cd \databasefile_upload
bin
put c:\ascii-file-from-sql.txt
bye
===

On the sql server you write the command (in a sp or whatever)

xp_cmdshell 'ftp -n -s:ftp_command.txt'

this should work in theory :)
 
Your solution works in reality as well. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top