I have a job that executes a stored procedure I wrote. The stored procedure itself is fairly simply. Based on a record count, it does a Select...Into and then a Delete. Afterwards, it then uses msdb.dbo.sp_send_dbmail to send a message depending on if the record count was Zero (in which case nothing else was done) or > Zero.
This job worked fine in SQL 2000 using a sp_stmp_sendmail procedure we had created in the database. When I moved it to SQL 2k5, I had to change it because that proc was no longer working. However, even after I changed it to dbmail, I keep getting the same error message.
I've checked the job from top to bottom. I'm not doing a SETUSER anywhere it in and the "Run AS" isn't set because the job step is a Transact-SQL step.
Does anyone have any notion as to what might be causing the problem?
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
This job worked fine in SQL 2000 using a sp_stmp_sendmail procedure we had created in the database. When I moved it to SQL 2k5, I had to change it because that proc was no longer working. However, even after I changed it to dbmail, I keep getting the same error message.
Error said:Date 9/6/2006 6:23:20 AM
Log Job History (BadRefunds)
Step ID 1
Server MYServer
Job Name BadRefunds
Step Name Null_NoRefunds_Check
Duration 00:00:00
Sql Severity 16
Sql Message ID 15157
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Unable to perform a SETUSER to the requested username 'dbo' because the username is invalid for database 'apacs'. The step failed.
I've checked the job from top to bottom. I'm not doing a SETUSER anywhere it in and the "Run AS" isn't set because the job step is a Transact-SQL step.
Does anyone have any notion as to what might be causing the problem?
Thanks,
Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"