How to export Resultset from cursor to excel

  • I have written a cursor that gets all the relevant data for each dept and emails them the results. How can I export the results to them in an excel spread sheet, it cannot be a single spreadsheet as only the relevant data must be sent to the dept.

    any help will be appreciated

  • Interesting problem. I think what you want to do is loop through a series of departments and call a DTS package to email the results. At least that's what I'd do.

    Here's a looping example: http://www.sqldts.com/?246

    Or my choice, use one package to loop and call another inside it: http://www.sqldts.com/default.aspx?215.

  • A script was posted many moons ago that took on this issue from T-SQL, I've neved had a need to actually try it out but it looks like it should at least come close to what you need.

     

    http://www.sqlservercentral.com/scripts/contributions/763.asp



    Everett Wilson
    ewilson10@yahoo.com

  • I've achieved something similar to this using a table variable, sp_makewebtask and xp_smtp_sendmail.

    The table variable holds the list of departments which are passed one at a time to sp_makewebtask which just creates a tab-delimited text file and then xp_smtp_sendmail emails it out.

    --------------------
    Colt 45 - the original point and click interface

Viewing 4 posts - 1 through 3 (of 3 total)

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