Back to OIM Explorer

dbo.CPL_PComplianceCheckMakeProc_h

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 10.683 characters

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.CPL_FCVRuleGuidToProcName source text reference
  • references source dbo.QBM_FCVBinaryToString source text reference
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_FSQProcedureDef source text reference
  • references source dbo.QER_FGIBitPatternInheritInfo source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PMNTableInsert source text reference
  • references source dbo.QBM_PMNTableOriginUpdate source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSQLCreate source text reference
  • references source dbo.QER_PMNTableAddViewProperties source text reference

Complete Source

SQL422 lines
1CREATE PROCEDURE CPL_PComplianceCheckMakeProc_h(2  @uid_ComplianceRule varchar(38)3)4AS5BEGIN6  DECLARE @whereClause nvarchar(max)7  DECLARE @UID_NonCompliance varchar(38)8  DECLARE @fehler int9  DECLARE @SNM_ComplianceCheck_PWO nvarchar(64)10  DECLARE @newString nvarchar(16)11  DECLARE @GranString nvarchar(16)12  DECLARE @Ident_ComplianceRule nvarchar(64)13  DECLARE @isToGrantEver BIT14  DECLARE @Procname nvarchar(1000)15  DECLARE @IsCrossPersonCheck BIT16  DECLARE @IsPersonStoreInverted BIT17  DECLARE @IsSimpleMode BIT18  DECLARE @SimpleMasterFilter varchar(32) = dbo.QBM_FCVBinaryToString(convert(varbinary, dbo.QER_FGIBitPatternInheritInfo('master',19  1)),20  0)21  DECLARE @SQLcmdKomplett nvarchar(max)22  DECLARE @parameters nvarchar(1000) = N '@SlotNumber int'23  DECLARE @DebugSwitch int = 024  DECLARE @UncommentCode BIT = 125  DECLARE @DebugLevel char(1) = 'W'26  DECLARE @Declarations nvarchar(max) = N '27	declare @GenProcID varchar(38)28	declare @Sourcedata QBM_YDataForDelta29		, @CountDeltaQantity int 30		, @CountDeltaOrigin int 31	declare @DBQueueCurrent QBM_YDBQueueCurrent3233	insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID)34						select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID35					from QBMDBQueueCurrent cu with (readpast)36					where cu.SlotNumber = @SlotNumber37		if @@rowcount = 038		 begin39			goto EndLabel40		 end41	42'43  DECLARE @contentDN1 nvarchar(max) = N '4445	exec QBM_PDBQueueCalculateDelta @SourceData,46									 @DeltaQuantity = 0,47								@DeltaDelete = 0,48								@DeltaInsert = 1,49								@DeltaOrigin = 1, 50								@CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output51								, @UseIsInEffect = 052								, @SlotNumber = @SlotNumber 53							, @DBQueueCurrentExtern = @DBQueueCurrent5455	select @ret = 056	select top 1 @GenProcID = cu.GenProcID57		from @DBQueueCurrent cu 5859	if isnull(@GenProcID, '''') = ''''60	 begin61		select @GenProcID = newid() 62	 end63	if @CountDeltaOrigin > 0 64	 begin65		update #QBMDeltaOrigin66			set GenProcID = @GenProcID 67			where GenProcID is null68		exec QBM_PMNTableOriginUpdate ''PersonInBaseTree'', ''UID_Org'', ''UID_Person''6970	 end7172	 if @CountDeltaQantity > 073	  begin74		update #QBMDeltaInsert75			 set GenProcID = @GenProcID  76		where GenProcID is null77		exec QER_PMNTableAddViewProperties ''PersonInBaseTree''78		exec QBM_PMNTableInsert ''PersonInBaseTree'', ''UID_Org'', ''UID_Person'', @TargetIsView = 17980	 end 8182'83  DECLARE @Content1 nvarchar(max)84  DECLARE @Content2 nvarchar(max)85  DECLARE @StringPatternDynmamic varchar(16)86  DECLARE @StringPatternDynmamicInv varchar(16)87  DECLARE @StringPatternDelay varchar(16)88  DECLARE @StringPatternDelayInv varchar(16)89  SET XACT_ABORT OFF90  BEGIN TRY91    SELECT92      @StringPatternDynmamic = dbo.QBM_FCVBinaryToString(CONVERT(varbinary, dbo.QBM_FGIBitPatternXOrigin('|Dynamic|',93      0)),94      0)95    SELECT96      @StringPatternDynmamicInv = dbo.QBM_FCVBinaryToString(CONVERT(varbinary, dbo.QBM_FGIBitPatternXOrigin('|Dynamic|',97      1)),98      0)99    SELECT100      @StringPatternDelay = dbo.QBM_FCVBinaryToString(CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',101      0)),102      0)103    SELECT104      @StringPatternDelayInv = dbo.QBM_FCVBinaryToString(CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',105      1)),106      0)107    SELECT108      @whereClause = whereclause,109      @UID_NonCompliance = isnull(cr.UID_NonCompliance,110      ''),111      @SNM_ComplianceCheck_PWO = isnull(cr.DetectRuleTypeForPWO,112      ''),113      @Ident_ComplianceRule = replace(isnull(cr.Ident_ComplianceRule, N ''),114      N '''',115      N ''''''),116      @isToGrantEver = isToGrantEver,117      @IsCrossPersonCheck = cr.IsCrossPersonCheck,118      @IsPersonStoreInverted = cr.IsPersonStoreInverted,119      @IsSimpleMode = cr.IsSimpleMode120    FROM ComplianceRule cr121    WHERE122      cr.UID_ComplianceRule = @uid_complianceRule123    IF rtrim(isnull(@whereClause, N '')) = N ''124    BEGIN125      SELECT @whereClause = N '1=1'126    END127    IF @IsSimpleMode = 1 AND @IsCrossPersonCheck = 0128    BEGIN129      SELECT130        @whereClause = replace(@whereclause,131        'as cm on cm.ObjectKeyElement = pho.ObjectKey',132        CONCAT('as cm on cm.ObjectKeyElement = pho.ObjectKey and pho.InheritInfo & ', @SimpleMasterFilter, ' > 0'))133    END134    IF @SNM_ComplianceCheck_PWO = ''135    BEGIN136      SELECT @SNM_ComplianceCheck_PWO = 'NewRule'137    END138    IF @isToGrantEver = 1139    BEGIN140      SELECT @SNM_ComplianceCheck_PWO = 'AnyRule'141    END142    SELECT143      @content1 = CONCAT('144145insert into @SourceData(146						IsUpcommingContent, XOriginAfter147						, Element, AssignedElement, XOriginBefore148						)149150	select 0, 0151			, '''152      ,153      @UID_NonCompliance,154      ''', uid_Person , Xorigin155		from PersonInBaseTree156			where uid_org = ''',157      @UID_NonCompliance,158      '''159			and XOrigin > 0160161-- was nicht dbo.QBM_F G I BitPatternXOrigin("|Dynamic|", 0) ist, bleibt erhalten162insert into @SourceData(163						IsUpcommingContent, XOriginAfter164						, Element, AssignedElement, XOriginBefore165						)166167	select 1, Xorigin & '168      ,169      @StringPatternDynmamicInv,170      '171			, ''',172      @UID_NonCompliance,173      ''', uid_Person , 0174		from PersonInBaseTree175			where uid_org = ''',176      @UID_NonCompliance,177      '''178			 and Xorigin & ',179      @StringPatternDynmamicInv,180      ' > 0181182insert into @SourceData(183						IsUpcommingContent, XOriginBefore, XOriginAfter184						, Element, AssignedElement185						)186	select 1, 0,  '187      ,188      @StringPatternDynmamic,189      ' 190			, ''',191      @UID_NonCompliance,192      ''' , uid_Person 193from Person 194	where (195-- Start Usercondition196')197    SELECT198      @content2 = CONCAT('199200-- End UserCondition201)202',203      ' and ',204    CASE @IsPersonStoreInverted205      WHEN 1 THEN206    'not'207    ELSE ''208    END,209    ' exists (select top 1 1210				from ComplianceSubRulePerson csp211				where csp.UID_Person = Person.UID_Person 212				 and csp.UID_ComplianceRule = '''213    ,214    @uid_ComplianceRule,215    '''216				)217						218')219    SELECT220      @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule,221      'Rule')222    SELECT223      @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname,224      '@Slotnumber int',225      @Declarations + @content1 + @whereclause + @content2 + @contentDN1,226      N 'Compliance rule (all person): ' + @Ident_ComplianceRule + '(' + @uid_ComplianceRule + ')')227    IF @DebugSwitch > 0228    BEGIN229      print @SQLcmdKomplett230    END231    EXEC QBM_PSQLCreate @Procname,232    'P',233      @SQLcmdKomplett,234      @UnComment = @UncommentCode235    SELECT236      @content1 = CONCAT('237238insert into @SourceData(239						IsUpcommingContent, XOriginAfter240						, Element, AssignedElement, XOriginBefore241						)242243	select 0, 0244			, '''245      ,246      @UID_NonCompliance,247      ''', uid_Person , Xorigin248		from PersonInBaseTree join @DBQueueCurrent xxpara on PersonInBaseTree.uid_person = xxpara.uid_parameter249											and PersonInBaseTree.XOrigin > 0250			where uid_org = '''251      ,252      @UID_NonCompliance,253      '''254255-- was nicht dbo.QBM_F G I BitPatternXOrigin("|Dynamic|", 0) ist, bleibt erhalten256insert into @SourceData(257						IsUpcommingContent, XOriginAfter258						, Element, AssignedElement, XOriginBefore259						)260261	select 1, Xorigin & '262      ,263      @StringPatternDynmamicInv,264      '265			, ''',266      @UID_NonCompliance,267      ''', uid_Person , 0268		from PersonInBaseTree join @DBQueueCurrent xxpara on PersonInBaseTree.uid_person = xxpara.uid_parameter269			where uid_org = '''270      ,271      @UID_NonCompliance,272      '''273			 and Xorigin & ',274      @StringPatternDynmamicInv,275      ' > 0276277insert into @SourceData(278						IsUpcommingContent, XOriginBefore, XOriginAfter279						, Element, AssignedElement280						)281	select 1, 0,  '282      ,283      @StringPatternDynmamic,284      '285			, ''',286      @UID_NonCompliance,287      ''' , uid_Person 288from Person join @DBQueueCurrent xxpara on person.uid_person = xxpara.uid_parameter289	where (290-- Start Usercondition291')292    SELECT293      @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule,294      'Person')295    SELECT296      @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname,297      '@Slotnumber int',298      @Declarations + @content1 + @whereclause + @content2 + @contentDN1,299      N 'Compliance rule (given person): ' + @Ident_ComplianceRule + '(' + @uid_ComplianceRule + ')')300    IF @DebugSwitch > 0301    BEGIN302      print @SQLcmdKomplett303    END304    EXEC QBM_PSQLCreate @Procname,305    'P',306      @SQLcmdKomplett,307      @Uncomment = @UncommentCode308    DECLARE @PreInsert nvarchar(max)309    DECLARE @PostInsert nvarchar(max)310    SELECT311      @PreInsert = '312declare @hp QBM_YSingleGUID313--declare @hp t a b l e(uid_person varchar(38) collate database_default)314315insert into @hp (UID_SingleGuid /*uid_person*/)316select uid_person from person 317			join ( select distinct uid_person as xxpUID_Person318					from HelperPWOPersonHasObject319					where uid_PersonWantsOrg = @UID_PersonWantsOrg320%new%%ug%					 and IsExisting = 0321						and ~ %IsCrossPersonCheck% & IsFromSubIdentityOnly = 0322				) as xxp on xxp.xxpUID_Person = Person.UID_Person323%new% left outer join (select uid_org as xxzuid_org, uid_person as xxzuid_person from PersonInBaseTree  where uid_org = '''324      + rtrim(@UID_NonCompliance) + N '''325%new%					and XMarkedForDeletion & ' + @StringPatternDelay + ' = 0326%new%%gran%					and IsDecisionMade = 1327%new%%gran%					and IsExceptionGranted = 1328%new%					) as xxz on person.uid_person = xxz.xxzuid_person329  where 330%new%	xxz.xxzuid_person is null and331	exists	( select top 1 1 where 332-- StartUserCondition 333'334    SELECT335      @PreInsert = replace(@PreInsert,336      N '%IsCrossPersonCheck%',337      STR(@IsCrossPersonCheck))338    IF @SNM_ComplianceCheck_PWO = 'NewRule'339    BEGIN340      SELECT341        @PreInsert = replace(@PreInsert,342        N '%new%',343        N '')344      SELECT345        @PreInsert = replace(@PreInsert,346        N '%gran%',347        N '--')348      SELECT349        @PreInsert = replace(@PreInsert,350        N '%ug%',351        N '')352    END353    IF @SNM_ComplianceCheck_PWO = 'UnGrantedRule'354    BEGIN355      SELECT356        @PreInsert = replace(@PreInsert,357        N '%new%',358        N '')359      SELECT360        @PreInsert = replace(@PreInsert,361        N '%gran%',362        N '')363      SELECT364        @PreInsert = replace(@PreInsert,365        N '%ug%',366        N '--')367    END368    IF @SNM_ComplianceCheck_PWO = 'AnyRule'369    BEGIN370      SELECT371        @PreInsert = replace(@PreInsert,372        N '%new%',373        N '--')374      SELECT375        @PreInsert = replace(@PreInsert,376        N '%gran%',377        N '--')378      SELECT379        @PreInsert = replace(@PreInsert,380        N '%ug%',381        N '')382    END383    SELECT384      @PostInsert = CONCAT(@Content2,385      '386insert into  #QBMDeltaInsert (Element, AssignedElement, XOrigin , XIsInEffect)387  select xxhp.UID_SingleGuid /*uid_person*/ , ''',388      rtrim(@uid_complianceRule),389      N ''', 1, 1390  from @hp xxhp 391392')393    SELECT394      @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule,395      'ITShopOrder')396    SELECT @parameters = N ' @uid_PersonWantsOrg varchar(38) '397    SELECT398      @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname,399      @Parameters,400      @Preinsert + @whereclause + @Postinsert,401      N 'Compliance rule (ITShop order): ' + @Ident_ComplianceRule + '(' + @uid_ComplianceRule + ')')402    IF @DebugSwitch > 0403    BEGIN404      print @SQLcmdKomplett405    END406    EXEC QBM_PSQLCreate @Procname,407    'P',408      @SQLcmdKomplett,409      @Uncomment = @UncommentCode410  END TRY411  BEGIN CATCH412    EXEC QBM_PSessionErrorAdd DEFAULT,413      @SQLcmdKomplett414    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()415    RAISERROR(@Rethrow,416    18,417    1)418      WITH NOWAIT419  END CATCH420  ende:421  RETURN422END
Open raw exported source
SQL ยท Raw209 lines
1   create   procedure CPL_PComplianceCheckMakeProc_h  (@uid_ComplianceRule varchar(38)) as begin declare @whereClause nvarchar(max) declare @UID_NonCompliance2 varchar(38) declare @fehler int declare @SNM_ComplianceCheck_PWO nvarchar(64) declare @newString nvarchar(16) declare @GranString nvarchar(16) declare3 @Ident_ComplianceRule nvarchar(64) declare @isToGrantEver bit declare @Procname nvarchar(1000) declare @IsCrossPersonCheck bit declare @IsPersonStoreInverted4 bit declare @IsSimpleMode bit declare @SimpleMasterFilter varchar(32) = dbo.QBM_FCVBinaryToString(convert(varbinary, dbo.QER_FGIBitPatternInheritInfo(5'master', 1)) , 0)  declare @SQLcmdKomplett nvarchar(max) declare @parameters nvarchar(1000) = N'@SlotNumber int' declare @DebugSwitch int = 0 declare 6@UncommentCode bit = 1  declare @DebugLevel char(1) = 'W' declare @Declarations nvarchar(max) = N'7	declare @GenProcID varchar(38)8	declare @Sourcedata QBM_YDataForDelta9		, @CountDeltaQantity int 10		, @CountDeltaOrigin int 11	declare @DBQueueCurrent QBM_YDBQueueCurrent1213	insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID)14						select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID15					from QBMDBQueueCurrent cu with (readpast)16					where cu.SlotNumber = @SlotNumber17		if @@rowcount = 018		 begin19			goto EndLabel20		 end21	22'23 declare @contentDN1 nvarchar(max) = N'2425	exec QBM_PDBQueueCalculateDelta @SourceData,26									 @DeltaQuantity = 0,27								@DeltaDelete = 0,28								@DeltaInsert = 1,29								@DeltaOrigin = 1, 30								@CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output31								, @UseIsInEffect = 032								, @SlotNumber = @SlotNumber 33							, @DBQueueCurrentExtern = @DBQueueCurrent3435	select @ret = 036	select top 1 @GenProcID = cu.GenProcID37		from @DBQueueCurrent cu 3839	if isnull(@GenProcID, '''') = ''''40	 begin41		select @GenProcID = newid() 42	 end43	if @CountDeltaOrigin > 0 44	 begin45		update #QBMDeltaOrigin46			set GenProcID = @GenProcID 47			where GenProcID is null48		exec QBM_PMNTableOriginUpdate ''PersonInBaseTree'', ''UID_Org'', ''UID_Person''4950	 end5152	 if @CountDeltaQantity > 053	  begin54		update #QBMDeltaInsert55			 set GenProcID = @GenProcID  56		where GenProcID is null57		exec QER_PMNTableAddViewProperties ''PersonInBaseTree''58		exec QBM_PMNTableInsert ''PersonInBaseTree'', ''UID_Org'', ''UID_Person'', @TargetIsView = 15960	 end 6162'63 declare @Content1 nvarchar(max) declare @Content2 nvarchar(max) declare @StringPatternDynmamic varchar(16) declare @StringPatternDynmamicInv varchar(1664) declare @StringPatternDelay varchar(16) declare @StringPatternDelayInv varchar(16) SET XACT_ABORT OFF BEGIN TRY select @StringPatternDynmamic = dbo.QBM_FCVBinaryToString65( CONVERT(varbinary, dbo.QBM_FGIBitPatternXOrigin('|Dynamic|',0)), 0) select @StringPatternDynmamicInv = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, 66dbo.QBM_FGIBitPatternXOrigin('|Dynamic|',1)), 0) select @StringPatternDelay = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel67('|Delay|',0)), 0) select @StringPatternDelayInv = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',1)), 0) select68 @whereClause = whereclause, @UID_NonCompliance = isnull(cr.UID_NonCompliance,''), @SNM_ComplianceCheck_PWO = isnull(cr.DetectRuleTypeForPWO, ''), @Ident_ComplianceRule69 = replace(isnull(cr.Ident_ComplianceRule, N''), N'''', N'''''') , @isToGrantEver = isToGrantEver , @IsCrossPersonCheck = cr.IsCrossPersonCheck , @IsPersonStoreInverted70 = cr.IsPersonStoreInverted , @IsSimpleMode = cr.IsSimpleMode from ComplianceRule cr where cr.UID_ComplianceRule = @uid_complianceRule if rtrim(isnull(@whereClause71, N'') ) = N'' begin select @whereClause = N'1=1' end if @IsSimpleMode = 1 and @IsCrossPersonCheck = 0 begin select @whereClause = replace(@whereclause72 , 'as cm on cm.ObjectKeyElement = pho.ObjectKey' , concat('as cm on cm.ObjectKeyElement = pho.ObjectKey and pho.InheritInfo & ', @SimpleMasterFilter ,73 ' > 0') ) end  if @SNM_ComplianceCheck_PWO = '' begin select @SNM_ComplianceCheck_PWO = 'NewRule' end  if @isToGrantEver = 1 begin select @SNM_ComplianceCheck_PWO74 = 'AnyRule' end   select @content1 = concat('7576insert into @SourceData(77						IsUpcommingContent, XOriginAfter78						, Element, AssignedElement, XOriginBefore79						)8081	select 0, 082			, '''83, @UID_NonCompliance, ''', uid_Person , Xorigin84		from PersonInBaseTree85			where uid_org = ''', @UID_NonCompliance, '''86			and XOrigin > 08788-- was nicht dbo.QBM_F G I BitPatternXOrigin("|Dynamic|", 0) ist, bleibt erhalten89insert into @SourceData(90						IsUpcommingContent, XOriginAfter91						, Element, AssignedElement, XOriginBefore92						)9394	select 1, Xorigin & '95 , @StringPatternDynmamicInv , '96			, ''', @UID_NonCompliance, ''', uid_Person , 097		from PersonInBaseTree98			where uid_org = ''', @UID_NonCompliance99, '''100			 and Xorigin & ' , @StringPatternDynmamicInv , ' > 0101102insert into @SourceData(103						IsUpcommingContent, XOriginBefore, XOriginAfter104						, Element, AssignedElement105						)106	select 1, 0,  '107 , @StringPatternDynmamic , ' 108			, ''', @UID_NonCompliance, ''' , uid_Person 109from Person 110	where (111-- Start Usercondition112' )  select @content2 113= concat('114115-- End UserCondition116)117', ' and ', case @IsPersonStoreInverted when 1 then 'not' else '' end , ' exists (select top 1 1118				from ComplianceSubRulePerson csp119				where csp.UID_Person = Person.UID_Person 120				 and csp.UID_ComplianceRule = '''121, @uid_ComplianceRule, '''122				)123						124' )  select @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule, 'Rule') select @SQLcmdKomplett = 125dbo.QBM_FSQProcedureDef(@Procname, '@Slotnumber int', @Declarations + @content1 + @whereclause + @content2 + @contentDN1 , N'Compliance rule (all person): '126 + @Ident_ComplianceRule + '(' + @uid_ComplianceRule + ')' ) if @DebugSwitch > 0 begin print @SQLcmdKomplett end exec QBM_PSQLCreate @Procname, 'P', @SQLcmdKomplett127, @UnComment = @UncommentCode select @content1 = concat('128129insert into @SourceData(130						IsUpcommingContent, XOriginAfter131						, Element, AssignedElement, XOriginBefore132						)133134	select 0, 0135			, '''136, @UID_NonCompliance , ''', uid_Person , Xorigin137		from PersonInBaseTree join @DBQueueCurrent xxpara on PersonInBaseTree.uid_person = xxpara.uid_parameter138											and PersonInBaseTree.XOrigin > 0139			where uid_org = '''140, @UID_NonCompliance , '''141142-- was nicht dbo.QBM_F G I BitPatternXOrigin("|Dynamic|", 0) ist, bleibt erhalten143insert into @SourceData(144						IsUpcommingContent, XOriginAfter145						, Element, AssignedElement, XOriginBefore146						)147148	select 1, Xorigin & '149 , @StringPatternDynmamicInv , '150			, ''', @UID_NonCompliance , ''', uid_Person , 0151		from PersonInBaseTree join @DBQueueCurrent xxpara on PersonInBaseTree.uid_person = xxpara.uid_parameter152			where uid_org = '''153, @UID_NonCompliance , '''154			 and Xorigin & ' , @StringPatternDynmamicInv , ' > 0155156insert into @SourceData(157						IsUpcommingContent, XOriginBefore, XOriginAfter158						, Element, AssignedElement159						)160	select 1, 0,  '161 , @StringPatternDynmamic , '162			, ''', @UID_NonCompliance , ''' , uid_Person 163from Person join @DBQueueCurrent xxpara on person.uid_person = xxpara.uid_parameter164	where (165-- Start Usercondition166'167 )  select @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule, 'Person') select @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname, '@Slotnumber int'168, @Declarations + @content1 + @whereclause + @content2 + @contentDN1 , N'Compliance rule (given person): ' + @Ident_ComplianceRule + '(' + @uid_ComplianceRule169 + ')' ) if @DebugSwitch > 0 begin print @SQLcmdKomplett end exec QBM_PSQLCreate @Procname, 'P', @SQLcmdKomplett, @Uncomment = @UncommentCode    declare170 @PreInsert nvarchar(max)  declare @PostInsert nvarchar(max)  select @PreInsert = '171declare @hp QBM_YSingleGUID172--declare @hp t a b l e(uid_person varchar(38) collate database_default)173174insert into @hp (UID_SingleGuid /*uid_person*/)175select uid_person from person 176			join ( select distinct uid_person as xxpUID_Person177					from HelperPWOPersonHasObject178					where uid_PersonWantsOrg = @UID_PersonWantsOrg179%new%%ug%					 and IsExisting = 0180						and ~ %IsCrossPersonCheck% & IsFromSubIdentityOnly = 0181				) as xxp on xxp.xxpUID_Person = Person.UID_Person182%new% left outer join (select uid_org as xxzuid_org, uid_person as xxzuid_person from PersonInBaseTree  where uid_org = '''183 + rtrim(@UID_NonCompliance) + N'''184%new%					and XMarkedForDeletion & ' + @StringPatternDelay + ' = 0185%new%%gran%					and IsDecisionMade = 1186%new%%gran%					and IsExceptionGranted = 1187%new%					) as xxz on person.uid_person = xxz.xxzuid_person188  where 189%new%	xxz.xxzuid_person is null and190	exists	( select top 1 1 where 191-- StartUserCondition 192'193 select @PreInsert = replace(@PreInsert, N'%IsCrossPersonCheck%', STR(@IsCrossPersonCheck) ) if @SNM_ComplianceCheck_PWO = 'NewRule' begin select @PreInsert194 = replace(@PreInsert, N'%new%', N'') select @PreInsert = replace(@PreInsert, N'%gran%', N'--') select @PreInsert = replace(@PreInsert, N'%ug%', N'') end195 if @SNM_ComplianceCheck_PWO = 'UnGrantedRule' begin select @PreInsert = replace(@PreInsert, N'%new%', N'') select @PreInsert = replace(@PreInsert, N'%gran%'196, N'') select @PreInsert = replace(@PreInsert, N'%ug%', N'--')  end if @SNM_ComplianceCheck_PWO = 'AnyRule' begin select @PreInsert = replace(@PreInsert197, N'%new%', N'--') select @PreInsert = replace(@PreInsert, N'%gran%', N'--') select @PreInsert = replace(@PreInsert, N'%ug%', N'') end   select @PostInsert198 = concat( @Content2, '199insert into  #QBMDeltaInsert (Element, AssignedElement, XOrigin , XIsInEffect)200  select xxhp.UID_SingleGuid /*uid_person*/ , '''201 , rtrim(@uid_complianceRule) , N''', 1, 1202  from @hp xxhp 203204' )    select @procname = dbo.CPL_FCVRuleGuidToProcName(@uid_complianceRule, 'ITShopOrder'205) select @parameters = N' @uid_PersonWantsOrg varchar(38) ' select @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname , @Parameters , @Preinsert + @whereclause206 + @Postinsert , N'Compliance rule (ITShop order): ' + @Ident_ComplianceRule + '(' + @uid_ComplianceRule + ')' ) if @DebugSwitch > 0 begin print @SQLcmdKomplett207 end exec QBM_PSQLCreate @Procname, 'P', @SQLcmdKomplett, @Uncomment = @UncommentCode END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default, @SQLcmdKomplett208 declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: return end 209