Stored Procedure to write a file to an FTP site

Hi there,
is it possible to have a stored procedure to write the result of a query to an FTP site?

Lets said for instance select * from mytable where id =1

Than i have like 2 returned records and wrap those two records on a txt file and upload to an FTP site.
Is this possible and if it is can you point me to the right direction?
Who is Participating?
Peter HutchisonConnect With a Mentor Senior Network Systems SpecialistCommented:
What you can do is write a batch file (.BAT) and use the SqlCmd.exe to run the query and product a result and then use the FTP program to upload the file to the FTP site.
SQLCMD -S servername -U user -P pwd -q "query string" -o result.csv
FTP -s:ftp_cmds.txt
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.