Emailing Sproc Results

  • I want to be able to use blat for email out my results from a sproc... but it almost seems like I need to save the sproc results to a file before I can add them to the email... am I wrong on this?

    The purpose is that the system would check Once a week on Sunday, for active records that need processing, those older then (x) days old are retreived from this sproc, and I'd like to email the results of that sproc to each user that has pending records...

    I know I've seen procedures like this in the past but all my saved info is coming up short on this... any pointers (urls) or bol keywords are greatly appreciated...

    Thank you,

    -Francisco


    -Francisco

  • Have you tried save the result set into a temp table and send out to users with xp_sendmail? Of course you have configure your SQL Server mail.

  • No I haven't because I wanted to use "Blat" instead of sql_mail... I don't want to send it via Exchange.

    Maybe I'm overlooking something, but I thought I could somehow save the results of my sproc down to a file, CSV? or XLS? so that I can then use Blat's file attachment feature to send out the email, that would work too.

    I suppose I can loop through a cursor and add add the lines to a variable to push into the blat msg, that's not difficult at all, I was just hoping to append the results to the email is all :(.

    btw, since we are on the subject, would something like this work

    INSERT INTO #TEmp(Field1, field2,field3)

    EXEC MyDB.dbo.MySproc @Parameter

    where the results of the sproc are 3 fields... I keep getting an error when I try this 🙁

    -Francisco


    -Francisco

  • It should work as long as the stored procedure returns row set that have same columns defined as your temp table.

  • I am facing the same problem. I want to know

    what is "Blat".

    Awaiting for your reply

    quote:


    No I haven't because I wanted to use "Blat" instead of sql_mail... I don't want to send it via Exchange.

    Maybe I'm overlooking something, but I thought I could somehow save the results of my sproc down to a file, CSV? or XLS? so that I can then use Blat's file attachment feature to send out the email, that would work too.

    I suppose I can loop through a cursor and add add the lines to a variable to push into the blat msg, that's not difficult at all, I was just hoping to append the results to the email is all :(.

    btw, since we are on the subject, would something like this work

    INSERT INTO #TEmp(Field1, field2,field3)

    EXEC MyDB.dbo.MySproc @Parameter

    where the results of the sproc are 3 fields... I keep getting an error when I try this 🙁

    -Francisco


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

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