none
can we create pdf from an sql query at run time RRS feed

  • Question

  • Hi , 

    the below query i am using will create an out put and will store it in an excel in a drive and the db mail will pick up and send it to the people . 

    my doubt is , i should see that the output is created in pdf at run time and then db mail should pick up and send it , can you please help me to perform the same . 

                  execute as login = 'sa'

                               EXEC   msdb.dbo.sp_send_dbmail

                                             @profile_name = 'QIK',

                                             @recipients = 'TP2132@gmail.com',-- @nifi_recipients,--- 

                                             @copy_recipients     = 'TP2132@gamil.com',

                                             --@blind_copy_recipients = 'hemadribabu@gmail.com',  

                                             @body_format = 'HTML',

                                             @subject = 'test' ,

                                             @body    = 'test'

                                             ,@attach_query_result_as_file     = 1,

                                             @query_result_header              = 0,

                                             @query_result_no_padding          = 1,

                                             @query                                          = 'set nocount on;

                                                                                                           SELECT top 10 employee_code from HRMS40..epin_employee

                                                                                                           ',

                                             @query_attachment_filename        = 'TEST.xls',

                                             @query_result_separator                  = '    '


    hemadri

    Tuesday, March 6, 2018 1:46 PM

All replies