iluvwitter
MIS
Hi,
I am trying to send an email with query results in the text message. The query I am running is rather large but it seems to be having a problem with the values. I am able to run the proc with a simple select * from table statement but when I insert a value I get an incorrect syntax error. I can run the query standalone without issue. For example, when I run the following.
begin
exec msdb.dbo.sp_Send_dbmail
@profile_name = 'test',
@recipients = 'test@test.com',
@QUERY = 'SELECT * FROM tc..releasetypes where releasetype = 'u'',
@subject = 'test release type',
@body = 'Please check releasetype'
END
I get the following error message:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'u'.
Can anyone assist? The query I am actually trying to run consists of query existing table for specific values and copying those values in a table variable to store values, update values in table variable, return updated values. When I paste the entire query I run into the incorrect syntax problem for value 'u'.
Thanks!
I am trying to send an email with query results in the text message. The query I am running is rather large but it seems to be having a problem with the values. I am able to run the proc with a simple select * from table statement but when I insert a value I get an incorrect syntax error. I can run the query standalone without issue. For example, when I run the following.
begin
exec msdb.dbo.sp_Send_dbmail
@profile_name = 'test',
@recipients = 'test@test.com',
@QUERY = 'SELECT * FROM tc..releasetypes where releasetype = 'u'',
@subject = 'test release type',
@body = 'Please check releasetype'
END
I get the following error message:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'u'.
Can anyone assist? The query I am actually trying to run consists of query existing table for specific values and copying those values in a table variable to store values, update values in table variable, return updated values. When I paste the entire query I run into the incorrect syntax problem for value 'u'.
Thanks!