Export data to file

  • I need to create a stored procedure that will allow me to extract data from a query and save it to disk as CSV,MDB or DBF. Is this possible and if yes how?

  • How are you handling the export itself. Thru DTS or a user end application. In either case the query recordset can come from a straight sql statment or view or stored procedure but exporting to a specific file is a DTS or Application thing not SQL.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thru ASP page, client's will be able to search the database and export the result in the format of their choice.

    quote:


    How are you handling the export itself. Thru DTS or a user end application. In either case the query recordset can come from a straight sql statment or view or stored procedure but exporting to a specific file is a DTS or Application thing not SQL.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)


  • Thru ASP on the remote side the client will not be able to export directly to an MDB or XLS file.

    The CSV is possible as long as you output the data in CSV format to the page without HTML tags, they can save then with a .csv.

    You can potentially generate these on the server side with com objects.

    By opening the recordset and inserting into a generate MDB, XLS, CSV or whatever but I don't have any code right off to deal with this.

    Basically you would call to SQL to get the recordset and create an object instance with a name easy to ID and unique that can be stored and deleted when the session times out.

    I have not seen a way to create a physical XLS or MDB file so you may have to have an empty one to copy with a new name to work around this.

    When the data has been inserted then in theory you redirect their browser to the file and they download it.

    You will need to have a session level variable to store all the names of any files created for the users session.

    Then in the ON_SESSION_END of the global.asa you would have to go thru you session variable of generated files and delete each.

    Not sure how many users may be doing this at one time but you could run into file locking issues, space issues or any number of other things.

    Should be possible and I may try this at some point to get an idea exactly what to do but you should be able to do as outlined here.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thank you for your help but i found a way to do it with a dll that i have created in vb.

  • HI

    Can you teach me how to do this since u already have a solution on that?

    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply