• I had the same issue with sp_send_dbmail and the @query parameter called from a SQL job. I could successfully execute sp_send_dbmail/@query param' from the Query Analyzer but it would fail executing from inside a job. Drove me nuts ! I eventually discovered if I explicitly added to SQL Server the domain account the SQL Agent was running under, xp_loginfo would now return a result set for the SQL Agent account and my problem with sp_send_dbmail executing successfully from a job was fixed. In my environment the SQL Agent account was originally configured to access SQL Server through a windows domain group; that doesn't work. I had to explicitly add our SQL Agent account to SQL Server and assign Admin privileges. Very frustrating problem. Hope this helps all my fellow DBAs ! -CqlBoy

    ps: There's a somewhat related problem configuring DB Mirroring. You must explicitly add the SQL Agent account from the partner server to get DB Mirroring to configure and work properly. You can't use a domain group with SQL permissions.

    CQLBoy