• Hi all,

    Just wanted to add to my reply yesterday, with my issues with @query from within SQL Agent.

    I was able to get it to work by first running my @query before I ran the database mail stored procedure.

    I'm pretty sure there are several different causes of this error, but wanted to add my experiences in case it can help others.

    cheers, Mark