Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Email query result

 
   Database Help (Home) -> Notification Services RSS
Next:  Extracting the table names to which a fied is rel..  
Author Message
coady

External


Since: Mar 14, 2008
Posts: 2



(Msg. 1) Posted: Thu May 08, 2008 1:11 pm
Post subject: Email query result
Archived from groups: microsoft>public>sqlserver>notificationsvcs (more info?)

Hi,

I am new to SQL 2005.
I was trying to set up SQL agent to send a query result via email.
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'user@company.com',
@query = 'SELECT * FROM msdb.dbo.DASD,
@subject = 'DB Space',
@attach_query_result_as_file = 1 ;

The error message was:
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'DB'.
Msg 105, Level 15, State 1, Line 4
Unclosed quotation mark after the character string ',
@attach_query_result_as_file = 1 ;

'.


Thank you for any suggestions

 >> Stay informed about: Email query result 
Back to top
Login to vote
coady

External


Since: Mar 14, 2008
Posts: 2



(Msg. 2) Posted: Thu May 08, 2008 4:38 pm
Post subject: RE: Email query result [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thank you. I figured it out.

It's @query = 'SELECT * FROM msdb.dbo.DASD',
not @query = 'SELECT * FROM msdb.dbo.DASD,



"coady" wrote:

> Hi,
>
> I am new to SQL 2005.
> I was trying to set up SQL agent to send a query result via email.
> EXEC msdb.dbo.sp_send_dbmail
> @recipients = 'user@company.com',
> @query = 'SELECT * FROM msdb.dbo.DASD,
> @subject = 'DB Space',
> @attach_query_result_as_file = 1 ;
>
> The error message was:
> Msg 102, Level 15, State 1, Line 4
> Incorrect syntax near 'DB'.
> Msg 105, Level 15, State 1, Line 4
> Unclosed quotation mark after the character string ',
> @attach_query_result_as_file = 1 ;
>
> '.
>
>
> Thank you for any suggestions

 >> Stay informed about: Email query result 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SqlCacheDependency - Cache Invalidation wihout result set .. - Using the SQL 2005 "query notification" caching mechanism, I am caching three columns (UserId, UserName, Password) of a table called UserInfo in my web application cache. However, the cache gets invalidated (and needs to be re-loaded) when anot...

How do I get email notification working - I have been given the job of database administrator. I very good at SQL programming, but am just learning about things like backups, replication, etc. and am VERY shaky on anything involving network administration. I am not the one who installed Sq...

Setting up email for Operator in SQL2000 - ERROR - Hi, I'm trying to set up an Email name for an operator to be used inSQL Agent. When I test the Email Name, I get an error: > Error 22022: SQL Server Agent Error: The SQL Server Agent Mail session is not running: Check the mail profile and/or the SQL...

Aggregated Query not working in Query Notification - Any i.. - We are using an aggregated query for query notification MSDN says you can use count_big() and sum() with group by clause. select entry_date, count_big(entry_date) as cnt from dbo.my_stats where entry_date > '2008-04-10' group by entry_date entry_d...

"Notification Services" compared to "Query Notifications" - Hello everybody, Can anybody explain be the difference between "Notification Services" and "Query Notifications"? At the moment I'm using the SqlDependency class which, as i think, is based on "Query Notifications". This m...
   Database Help (Home) -> Notification Services All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]