Search code examples
sql-serverjobs

Error in SQL Server Job [SQLSTATE 42000] (Error 14636)


I have a problem with one of my jobs in SQL Server. This job executes two steps, one per stored procedure.

The stored procedure works fine when it is executed, but in the job, it throws an error

[SQLSTATE 42000] (Error 14636)

Can you help me?


Solution

  • This is probably because you don't have a default profile set for database mail.

    SELECT profile_id, name FROM msdb..sysmail_profile
    

    then

    UPDATE msdb..sysmail_principalprofile
    SET is_default = 1
    WHERE profile_id = <yourprofileid>