locked
Results of store procedure in email attachment RRS feed

  • Question

  • Hi

    does anyone can give me idea how to get the results of store procedure in file/Or report and i need to attach this file in an email
    but the results of store procedure  contains multiple header and details
    But the things is these header and details are not fixed they will be changing.
    This whole thing is we get  file which tranforms the data and creates three diffrent files and these files will be imported in application
    and i need to notify users having details of how many imported and how many did not.

    Thankz

    Thursday, June 7, 2012 3:13 PM

Answers

  • 1) SSRS report using subscription to deliver files

    2) EXEC msdb.dbo.sp_send_dbmail
         @profile_name = 'Name',
         @recipients = 'yy@dfdd.com' 
         @query = 'SELECT COUNT(*) FROM AdventureWorks.Person.Address',
         @subject = 'Error Log Count',
         @attach_query_result_as_file = 1 ;


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

    Thursday, June 7, 2012 5:24 PM
    Answerer

All replies

  • 1) SSRS report using subscription to deliver files

    2) EXEC msdb.dbo.sp_send_dbmail
         @profile_name = 'Name',
         @recipients = 'yy@dfdd.com' 
         @query = 'SELECT COUNT(*) FROM AdventureWorks.Person.Address',
         @subject = 'Error Log Count',
         @attach_query_result_as_file = 1 ;


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

    Thursday, June 7, 2012 5:24 PM
    Answerer
  • Hi thankz for ur time i was able to save  result of store procedure to file but the problem im having right now is
    results are saved in single line even though i have new line char in my store procedure but when i print results it gives ecaxtly how i need but when i tried to save the results to file its unable to do it.
    Can u tell me how to resilve this issue
    Thankz
    Thursday, June 7, 2012 5:57 PM