exporting data to a .csv file in a stored procedure

pts.
Tags:
SQL
SQL Server
I need to write the results of a query to a .csv file and ftp it from a stored procedure. The query part is no problem but I can't find anything on opening, writing to and ftp'ing the .csv file. Any ideas?

Answer Wiki

Thanks. We'll let you know when a new response is added.

The UTL_FILE Package has methods for creating the file on the operating system’s file system.

I don’t know anyway to ftp from within Oracle, but Oracle does have UTL_SMTP, so you could email it! 8^))

Seriously though, the way I handle it is to have a job awake on the operating system that finds new files to ftp and then ftp’s them.

~MrO~

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Oadegoke
    What you really need is the ability to execute Operating System commands from PL/SQL. You can find useful code on this from AskTom on Oracle site or Metalink. The particular implementation that I have uses Java store proc. This works well.
    0 pointsBadges:
    report
  • Kritchard
    Sorry, I forgot to mention that I am using MS SQL Server.
    0 pointsBadges:
    report
  • DaveInAZ
    You also forgot to mention what version of MS SQL Server you're using, but start by looking into using BCP and format files in MSDN. BCP handles the opening and writing of the file; the format file defines it as a csv. For the ftp part, go here http://www.sqlteam.com/item.asp?ItemID=6002
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following