存储过程未运行,可能是作业配置错误

我在sql服务器上有一个存储过程,其代码如下:

    USE [MASS]
GO
/****** Object:  StoredProcedure [dbo].[dossierEmailSend]    Script Date: 05/11/2019 17:36:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[dossierEmailSend]
AS
 --Create a holding table for the dossiers that met the criteria

DeclARE @dossiers TABLE (col1 varchar(100),col2 varchar(100),col3 varchar(100),col4 varchar(100));

 --Insert the dossiers that met the criteria

INSERT INTO @dossiers
SELECT no,nome,obrano,convert(varchar,datafinal) col4  
    FROM bo
    WHERE nmdos LIKE '%preço%'
    AND datafinal = DATEADD(day,-1,CONVERT(date,GETDATE()))

 --Create a row check to determine whether to send the email or not

DeclARE @rows int;
SET @rows = (SELECT COUNT(*) FROM @dossiers)

 --Set the body elements

DeclARE @message varchar(1000);
-- declare the xml data to pass to the HTML body
DeclARE @xml NVARCHAR(MAX);
-- body will hold the HTML formatted table in the email
DeclARE @body NVARCHAR(MAX);

 --Create the columns that will hold each row of data as xml

SET @xml = CAST(( SELECT col1 AS 'td','',col2 AS 'td',col3 AS 'td',col4 AS 'td'
FROM @dossiers
FOR XML PATH('tr'),ELEMENTS ) AS NVARCHAR(MAX))

 --Set the HTML for the body

SET @body ='<html><body><H3>dossier Info</H3>
<table border = 1> 
<tr>
<th> Num </th> <th> Nome </th> <th> dossier </th> <th> Data de Fecho </th></tr>'

 --Stitch everything together,appending the HTML table

SET @body = @body + @xml +'</table></body></html>'

SET NOCOUNT ON 

 --Check if any dossiers met the criteria

IF @rows > 0 
BEGIN

 --Send the email and append the data table to the body

EXEC dbo.uspSendEmail 'Encerramento dossier Preços','ssantos@mass.pt',@body,NULL,'filipeferreira@mass.pt'
SET NOCOUNT OFF

END

要运行此过程,我创建了一个作业,该任务会提取此过程,但事实是它没有运行。在工作属性上,我已设置:

对于成功操作,请退出报告成功的作业,而对于失败操作,请退出同一件事。我真的不知道错误是否在这里,对此家伙有何想法?

mengyingyu2009 回答:存储过程未运行,可能是作业配置错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3157526.html

大家都在问