Solved

Stored Procedure to write a file to an FTP site

Posted on 2014-12-23
1
154 Views
Last Modified: 2015-02-20
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?
Thanks
0
Comment
Question by:COHFL
1 Comment
 
LVL 19

Accepted Solution

by:
Peter Hutchison earned 500 total points
ID: 40515793
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.
e.g.
SQLCMD -S servername -U user -P pwd -q "query string" -o result.csv
FTP -s:ftp_cmds.txt
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question