Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Thu, 8 May 2008 13:11:01 -0700,    group: microsoft.public.sqlserver.notificationsvcs        back       


Email query result   
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
date: Thu, 8 May 2008 13:11:01 -0700   author:   coady

RE: Email query result   
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
date: Thu, 8 May 2008 16:38:05 -0700   author:   coady

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us