dbo.ATT_P47650F5671BCBA8B679125E_
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
Relations
- No extracted relations.
Typed Edges
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
Referenced By
Complete Source
1CREATE PROCEDURE ATT_P47650F5671BCBA8B679125E_(2 @UID_AttestationPolicy varchar(38),3 @CaseWhereClause nvarchar(max),4 @LimitOfOldCases int,5 @GivenObjects QBM_YParameterList READONLY6)7AS8BEGIN9 DECLARE @work QBM_YParameterList10 DECLARE @Ergebnis int = 111 SET XACT_ABORT OFF12 BEGIN TRY13 INSERT INTO @work(Parameter2)14 SELECT TOP 2000 dt.UID_AttestationCase15 FROM(16 SELECT17 c.UID_AttestationCase,18 ROW_NUMBER() over(partition BY c.objectkeybase19 ORDER BY c.xdateinserted DESC) AS rownumber20 FROM AttestationCase c21 WITH(readpast)22 JOIN(23 SELECT ObjectKeyBase24 FROM AttestationCase25 WITH(readpast)26 WHERE27 UID_AttestationPolicy = @UID_AttestationPolicy AND IsClosed = 1 AND(@CaseWhereClause IS NULL OR(@CaseWhereClause > ' ' AND ObjectKeyBase28 IN(29 SELECT Parameter130 FROM @GivenObjects)))31 GROUP BY ObjectKeyBase32 HAVING COUNT(*) > @LimitOfOldCases) AS ol33 ON c.ObjectKeyBase = ol.ObjectKeyBase34 WHERE35 c.UID_AttestationPolicy = @UID_AttestationPolicy AND c.IsClosed = 1) AS dt36 WHERE37 dt.rownumber > @LimitOfOldCases option(maxdop 1)38 SELECT @Ergebnis = @@ROWCOUNT39 DELETE AttestationCase40 FROM AttestationCase ac41 WITH(forceseek)42 JOIN @work w43 ON ac.UID_AttestationCase = w.Parameter2 option(maxdop 1)44 END TRY45 BEGIN CATCH46 EXEC QBM_PSessionErrorAdd DEFAULT47 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()48 RAISERROR(@Rethrow,49 18,50 1)51 WITH NOWAIT52 END CATCH53 endLabel:54 SET lock_timeout -155 RETURN(@Ergebnis)56END
Open raw exported source
1 create procedure ATT_P47650F5671BCBA8B679125E_(@UID_AttestationPolicy varchar(38) , @CaseWhereClause nvarchar(max) , @LimitOfOldCases int 2, @GivenObjects QBM_YParameterList readonly ) as begin declare @work QBM_YParameterList declare @Ergebnis int = 1 SET XACT_ABORT OFF BEGIN TRY insert into3 @work (Parameter2 ) select top 2000 dt.UID_AttestationCase from ( select c.UID_AttestationCase , ROW_NUMBER() over (partition by c.objectkeybase order4 by c.xdateinserted desc) as rownumber from AttestationCase c with (readpast) join ( select ObjectKeyBase from AttestationCase with (readpast) where 5UID_AttestationPolicy = @UID_AttestationPolicy and IsClosed = 1 and ( @CaseWhereClause is null or ( @CaseWhereClause > ' ' and ObjectKeyBase in (select6 Parameter1 from @GivenObjects) ) ) group by ObjectKeyBase having COUNT(*) > @LimitOfOldCases ) as ol on c.ObjectKeyBase = ol.ObjectKeyBase where c.UID_AttestationPolicy7 = @UID_AttestationPolicy and c.IsClosed = 1 ) as dt where dt.rownumber > @LimitOfOldCases option (maxdop 1) select @Ergebnis = @@ROWCOUNT delete AttestationCase8 from AttestationCase ac with(forceseek) join @work w on ac.UID_AttestationCase = w.Parameter2 option (maxdop 1) END TRY BEGIN CATCH exec QBM_PSessionErrorAdd9 default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: set lock_timeout10 -1 return (@Ergebnis) end 11