dbo.CPL_FTCCSPWOCheck
SQL_TABLE_VALUED_FUNCTION
Created 2026-04-14T23:18:41.677 · modified 2026-04-14T23:18:41.677 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@uid_personwantsorg | varchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| ComplianceRule | OBJECT_OR_COLUMN | ||
| ComplianceSubRule | OBJECT_OR_COLUMN | ||
| ComplianceSubRuleObject | OBJECT_OR_COLUMN | ||
| ComplianceSubRulePerson | OBJECT_OR_COLUMN | ||
| HelperPWOPersonHasObject | OBJECT_OR_COLUMN | ||
| PersonInBaseTree | OBJECT_OR_COLUMN | ||
| QBM_YParameterList | TYPE | ||
| QER_VPersonsAreMe | OBJECT_OR_COLUMN | ||
| dbo | CPL_FTCCSPersonHasObjectWPWO | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1 create function dbo.CPL_FTCCSPWOCheck(@uid_personwantsorg varchar(38)) returns @erg table ( UID_PersonWantsOrg varchar(38) collate database_default , 2UID_Person varchar(38) collate database_default , UID_ComplianceRule varchar(38) collate database_default , UID_NonCompliance varchar(38) collate database_default 3 , IsExceptionGranted bit , IsNewObject bit , IsNewRule bit ) as begin declare @PersonsPossible QBM_YParameterList insert into @PersonsPossible (Parameter1 4 ) select me.UID_PersonAlsoMe from HelperPWOPersonHasObject pho join QER_VPersonsAreMe me on pho.UID_Person = me.UID_PersonOrigin where pho.uid_personwantsorg 5 = @uid_personwantsorg union select pho.UID_Person from HelperPWOPersonHasObject pho where pho.uid_personwantsorg = @uid_personwantsorg declare @ComRuleforPerson 6 QBM_YParameterList insert into @ComRuleforPerson (Parameter1, Parameter2) select per.Parameter1, csrp.UID_ComplianceRule from @PersonsPossible per join 7 ComplianceSubRulePerson csrp with (readpast, forceSeek) on per.Parameter1 = csrp.UID_Person join ComplianceRule cr with (readpast, forceSeek) on csrp.UID_ComplianceRule 8 = cr.UID_ComplianceRule and cr.IsPersonStoreInverted = 0 and cr.IsWorkingCopy = 0 and cr.IsInActive = 0 union select per.Parameter1, cr.UID_ComplianceRule 9 from @PersonsPossible per join ComplianceRule cr on cr.IsPersonStoreInverted = 1 and cr.IsWorkingCopy = 0 and cr.IsInActive = 0 left outer join ComplianceSubRulePerson 10 csrp with (readpast, forceSeek) on per.Parameter1 = csrp.UID_Person and csrp.UID_ComplianceRule = cr.UID_ComplianceRule where csrp.UID_Person is null 11 DECLARE @InnerData TABLE ( UID_ComplianceRule VARCHAR(38) collate database_default ,UID_ComplianceSubRule VARCHAR(38) collate database_default ,UID_Person 12 VARCHAR(38) collate database_default ,IsNew int ,CountMatchesMin int ,ObjectKeyElement VARCHAR(138) collate database_default ) INSERT INTO @innerData(UID_ComplianceRule 13, UID_ComplianceSubRule, UID_Person, IsNew, CountMatchesMin, ObjectKeyElement) SELECT sr.UID_ComplianceRule, sr.UID_ComplianceSubRule, pho.UID_Person, 14pho.IsNew, sr.CountMatchesMin, cm.ObjectKeyElement FROM @ComRuleforPerson ptoc JOIN ComplianceRule cr on ptoc.Parameter2 = cr.UID_ComplianceRule AND cr.IsCrossPersonCheck 15 = 1 JOIN ComplianceSubRule sr on cr.UID_ComplianceRule = sr.UID_ComplianceRule JOIN ComplianceSubRuleObject cm on sr.UID_ComplianceSubRule = cm.UID_ComplianceSubRule 16 JOIN dbo.CPL_FTCCSPersonHasObjectWPWO(@UID_PersonWantsOrg, 1) pho ON pho.uid_person = ptoc.Parameter1 AND pho.Objectkey = cm.ObjectKeyElement AND ( pho.isNew 17 = 1 AND pho.uid_personwantsorg = @uid_personwantsorg OR pho.isNew = 0 ) UNION ALL SELECT sr.UID_ComplianceRule, sr.UID_ComplianceSubRule, pho.UID_Person 18, pho.IsNew, sr.CountMatchesMin, cm.ObjectKeyElement FROM @ComRuleforPerson ptoc JOIN ComplianceRule cr on ptoc.Parameter2 = cr.UID_ComplianceRule AND 19cr.IsCrossPersonCheck = 0 JOIN ComplianceSubRule sr on cr.UID_ComplianceRule = sr.UID_ComplianceRule JOIN ComplianceSubRuleObject cm on sr.UID_ComplianceSubRule 20 = cm.UID_ComplianceSubRule JOIN dbo.CPL_FTCCSPersonHasObjectWPWO(@UID_PersonWantsOrg, 0) pho ON pho.uid_person = ptoc.Parameter1 AND pho.Objectkey = 21cm.ObjectKeyElement AND ( pho.isNew = 1 AND pho.uid_personwantsorg = @uid_personwantsorg OR pho.isNew = 0 ) insert into @erg(UID_PersonWantsOrg , UID_Person 22 , UID_ComplianceRule , UID_NonCompliance , IsExceptionGranted , IsNewObject , IsNewRule) select @UID_PersonWantsOrg as uid_personwantsOrg, yy.uid_person 23, yy.uid_ComplianceRule, yy.uid_noncompliance, yy.isExceptionGranted, max(yy.isNewObject) as isNewObject, max(yy.isNewRule) as isNewRule from ( select 24 ps.uid_person, ps.uid_ComplianceRule, isnull(pinc.uid_org,'') as uid_noncompliance, isnull(pinc.isexceptiongranted, 0) as isExceptionGranted, ps.isNew 25 as isNewObject, (sign(len(isnull(pinc.uid_org,''))) ^1 ) & ps.isNew as isNewRule, ps.uid_complianceSubrule from ( select y.UID_ComplianceRule, y.UID_ComplianceSubRule 26, y.UID_Person, MAX(y.IsNew) as IsNew FROM @InnerData as y group by y.UID_ComplianceRule, y.UID_ComplianceSubRule, y.CountMatchesMin, y.UID_Person 27having COUNT(y.ObjectKeyElement) >= case y.CountMatchesMin when 0 then 1 else y.CountMatchesMin end ) as ps join compliancerule cr on ps.uid_complianceRule 28 = cr.uid_complianceRule and cr.IsInActive = 0 and cr.IsWorkingCopy = 0 left outer join PersonInBaseTree pinc on pinc.UID_Person = ps.UID_Person and 29 pinc.UID_Org = cr.uid_noncompliance ) as yy group by yy.uid_person, yy.uid_ComplianceRule, yy.uid_noncompliance , yy.isexceptiongranted having count(distinct 30 yy.uid_ComplianceSubRule) = (select count( * ) from ComplianceSubrule where uid_complianceRule = yy.uid_complianceRule ) return end 31
Module relation graph
Loading module relation graph…
Source-derived context
Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.
provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:18:41.677
None extracted.
Summary: writes INSERT into, INSERT INTO; reads/joins HelperPWOPersonHasObject, QER_VPersonsAreMe, ComplianceSubRulePerson, ComplianceRule, ComplianceSubRule…
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@uid_personwantsorg | varchar(38) | input |
DML targets
INSERT into INSERT INTOCalled routines
None extracted.
Read/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: None extracted.
Variables: @uid_personwantsorg @erg @PersonsPossible @ComRuleforPerson @InnerData @innerData @UID_PersonWantsOrg
Referenced by / reverse dependencies
Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.
| Referencing object | Relation | Evidence |
|---|---|---|
| dbo.CPL_FTCCSPWOCheckDetail | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.CPL_ZITShopMakeDecisionCR | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.CPL_FTCCSPWOCheckDetail | source text reference | SQL_INLINE_TABLE_VALUED_FUNCTION |
| dbo.CPL_ZITShopMakeDecisionCR | source text reference | creates object-layer jobs via QBM_PJobCreate*, calls object-layer method via HOCallMethod, uses session context values, has TRY/CATCH error handling |