• g.sarvesh (3/6/2008)


    Hi,

    I am using following query to use db mail sending and this is not giving any error:

    EXEC msdb.dbo.sp_send_dbmail @recipients= @EMail_ID ,

    @subject = 'New Job Post' ,

    @body = @Job_Description_brief ,

    @body_format = 'HTML' ,

    @profile_name = 'Profile Name';

    It is running successfully. 🙂

    I can do that all day long and it works splendidly. But as soon as I try to add @query = 'SELECT * FROM SomeTable', I get the error mentioned by the author of this thread. The SomeTable table only has about 10 rows in it, and I've got the user it's complaining about in the msdb database with the DatabaseMail role (not sure if that is exactly what the role is called as I'm not at work yet this morning and don't have it right in front of me at the moment) assigned.

    I can just loop through my result set and build a string and bypass this whole @query parameter mess entirely, but I shouldn't have to do that; the fact that this isn't working is fairly pissing me off.

    EDIT: Am I going bonkers or does my post quoting an earlier post show up before the post I quoted?