Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Notification Services / May 2008

Tip: Looking for answers? Try searching our database.

Email query result

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
coady - 08 May 2008 21:11 GMT
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
coady - 09 May 2008 00:38 GMT
Thank you. I figured it out.

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

> Hi,
>
[quoted text clipped - 16 lines]
>
> Thank you for any suggestions
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.