December 30, 2011 at 8:27 am
K - how about the send_db_mail query that you are using?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 8:31 am
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'My Profile' ,
@recipients = 'My email ADD' ,
@subject = 'Job Summary'
,@query = 'Exec dbo.JobSummaryUtil'
December 30, 2011 at 8:37 am
Does JobSummaryUtil exist in msdb?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 8:56 am
Yes it is there..i executed and working fine in SSMS
December 30, 2011 at 9:10 am
Are you able to send a test email through dbmail?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 9:16 am
yes my dbmail profile works fine...you can check the error message in above posts.
December 30, 2011 at 9:58 am
Using your proc and the email query it works fine for me under the following circumstances.
The database the query is executing from is msdb or I use the three part naming standard (as suggested) which would be msdb.dbo.JobSummaryUtil.
It will fail when not executing from msdb or when not using the three part naming standard.
Have you tried using the three part naming standard?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 10:06 am
Yes it works for me too now ..Thanks RNNR... but result in e-mail so weired format..
Can we do in excel format ?
December 30, 2011 at 10:13 am
Use the file attachment option
, [ @attach_query_result_as_file = ] attach_query_result_as_file ]
@attach_query_result_as_file = yourfile.xls or csv
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 10:30 am
worked with this options
,@attach_query_result_as_file = 1
,@query_attachment_filename ='Results.xls'
but data in file is not in particular order or the result in excel file can not see like SSMS Result pane.
December 30, 2011 at 10:31 am
The data in the file will be in the same order as specified in the original query. If there's no ORDER BY in the SELECT statement then you can't expect any particular order.
December 30, 2011 at 11:02 am
The output in the attachment is the same as if you ran the query with "results to text" instead of to "grid" and that's why it looks the way it does, regardless of the file extension you specify. If you want something "prettier" I believe your only option is to use the SSRS idea (with a subscribed report) as mentioned above
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
December 30, 2011 at 11:05 am
Nah - you can delimit the results in the mailed file using
@query_result_separator = ','
That said, you can replace the separator value with a |, tab, or something else if you deem it necessary.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 30, 2011 at 11:06 am
The problem with presenting data is that inevitably the presentation of the data comes into play 🙂
December 30, 2011 at 11:11 am
JeffRush (12/30/2011)
The problem with presenting data is that inevitably the presentation of the data comes into play 🙂
How true that is.
Depending on the audience, the far better solution should probably be an SSRS report.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 15 posts - 16 through 30 (of 31 total)
You must be logged in to reply to this topic. Login to reply