USP_REPORT_EXCHANGEPROCESSEXCEPTIONREPORT
Returns data used by Exchange process exception reports.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | nvarchar(36) | IN |
Definition
Copy
create procedure dbo.USP_REPORT_EXCHANGEPROCESSEXCEPTIONREPORT
(
@ID nvarchar(36)
)
with execute as owner
as
set nocount on;
declare @TABLENAME nvarchar(255);
declare @SQL nvarchar(4000);
begin try
select
@TABLENAME = BUSINESSPROCESSOUTPUT.TABLENAME
from
dbo.BUSINESSPROCESSOUTPUT
where
BUSINESSPROCESSOUTPUT.BUSINESSPROCESSSTATUSID = @ID and
BUSINESSPROCESSOUTPUT.TABLEKEY = 'EXCEPTION';
if not @TABLENAME is null and not OBJECT_ID(@TABLENAME) is null
begin
set @SQL = '
select
REASON
from ' + @TABLENAME + ' ';
end
else
begin
select 'No exceptions occurred during this process' as REASON
end
exec sp_executesql @SQL;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;