dbo.QBM_PMNTableOriginUpdate
SQL_STORED_PROCEDURE
Created 2025-06-27T17:57:29.597 · modified 2026-04-14T23:20:26.353 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@TargetTable | varchar | no |
@ElementColumn | varchar | no |
@AssignedElementColumn | varchar | no |
@RestrictionClause | nvarchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| DialogTable | OBJECT_OR_COLUMN | ||
| QBM_PExecuteSQLWithRetry_LLP | OBJECT_OR_COLUMN | ||
| QBM_PSessionContextSet | OBJECT_OR_COLUMN | ||
| QBM_PSessionErrorAdd | OBJECT_OR_COLUMN | ||
| QBM_YCursorBuffer | TYPE | ||
| dbo | QBM_FCVBinaryToString | OBJECT_OR_COLUMN | |
| dbo | QBM_FGIBitPatternXOrigin | OBJECT_OR_COLUMN | |
| dbo | QBM_FGIColumnExists | OBJECT_OR_COLUMN | |
| dbo | QBM_FGISessionContext | OBJECT_OR_COLUMN | |
| dbo | QBM_FGISessionErrorRethrow | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1 create procedure QBM_PMNTableOriginUpdate (@TargetTable varchar(30) , @ElementColumn varchar(30) , @AssignedElementColumn varchar(30) , @RestrictionClause 2 nvarchar(max) = '' ) as begin declare @GenProcID varchar(38) declare @SQLCmd nvarchar(max) declare @SQLPattern nvarchar(max) declare @ExistsXIsInEffect 3 bit = 0 declare @ExistsXdate bit = 0 declare @RestrictionClause_intern nvarchar(max) declare @DebugSwitch int = 0 declare @IsCreatePendingChange bit = 4 0 declare @Maske varchar(64) declare @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('') declare @XUser_R nvarchar(64) = dbo.QBM_FGISessionContext 5('XUser') declare @ElementCount int declare @ElementIndex int declare @MaxWaitTimeForMainOperation float = 5.0 SET XACT_ABORT OFF BEGIN TRY select @IsCreatePendingChange 6 = sign(t.PendingChangeBehavior & 0x01) from DialogTable t where t.TableName = @TargetTable select @Maske = dbo.QBM_FCVBinaryToString( dbo.QBM_FGIBitPatternXOrigin 7('|inherit|', 0), 0) select @ExistsXIsInEffect = dbo.QBM_FGIColumnExists(@TargetTable, 'XIsInEffect') select @ExistsXdate = dbo.QBM_FGIColumnExists(@TargetTable 8, 'XDateInserted') if isnull (@RestrictionClause, '') = '' begin select @RestrictionClause_intern = '' end else begin select @RestrictionClause_intern 9= concat(' and ( ' , @RestrictionClause , ' ) ') end select @SQLPattern = concat(N' 10 if exists (select top 1 1 11 from #QBMDeltaOrigin o 12 where o.XOrigin > 0 13 ) 14 begin 15 update ' 16 , @TargetTable , ' 17 set XOrigin = x.XOrigin' , case @ExistsXIsInEffect when 1 then ' 18 , XIsInEffect = x.XIsInEffect' else '' end , case @ExistsXdate 19 when 1 then ' 20 , XDateUpdated = GetUtcDate() 21 , XUserUpdated = ''' + OBJECT_NAME(@@procid) + '''' else '' end , ' 22 from ' , @TargetTable , ' y join #QBMDeltaOrigin x on y.' 23 , @ElementColumn , ' = x.Element 24 and y.' , @AssignedElementColumn , ' = x.AssignedElement 25 and x.GenProcID = ''@GenProcID'' 26 and x.XOrigin > 0 27 where (y.XOrigin <> x.XOrigin' 28 , case @ExistsXIsInEffect when 1 then ' 29 or y.XIsInEffect <> x.XIsInEffect' else '' end , ' ) 30 ' , @RestrictionClause_intern , ' 31 end 32' ) if @IsCreatePendingChange 33 = 1 begin select @SQLPattern = concat(@SQLPattern , 'if exists (select top 1 1 34 from #QBMDeltaOrigin o 35 where o.XOrigin = 0 36 ) 37 begin 38 update ' 39 , @TargetTable , ' 40 set XOrigin = 0' , case @ExistsXIsInEffect when 1 then ' 41 , XIsInEffect = 0' else '' end , case @ExistsXdate when 1 then ' 42 , XDateUpdated = GetUtcDate() 43 , XUserUpdated = ''' 44 + OBJECT_NAME(@@procid) + '''' else '' end , ' 45 from ' , @TargetTable , ' y join #QBMDeltaOrigin x on y.' , @ElementColumn , ' = x.Element 46 and y.' 47 , @AssignedElementColumn , ' = x.AssignedElement 48 and x.GenProcID = ''@GenProcID'' 49 and x.XOrigin = 0 50 where (y.XOrigin & ' 51 , @maske , ' > 0 ) 52 ' , @RestrictionClause_intern , ' 53 end 54 ' ) end else begin select @SQLPattern = concat(@SQLPattern , 'if exists (select top 1 1 55 from #QBMDeltaOrigin o 56 where o.XOrigin = 0 57 ) 58 begin 59 update ' 60 , @TargetTable , ' 61 set XOrigin = 0 ' , case @ExistsXdate when 1 then ' 62 , XDateUpdated = GetUtcDate() 63 , XUserUpdated = ''' + OBJECT_NAME(@@procid 64) + '''' else '' end , ' from ' , @TargetTable , ' y join #QBMDeltaOrigin x on y.' , @ElementColumn , ' = x.Element 65 and y.' , @AssignedElementColumn 66 , ' = x.AssignedElement 67 and x.GenProcID = ''@GenProcID'' 68 and x.XOrigin = 0 69-- where (y.XOrigin > 0 ) 70 ' , @RestrictionClause_intern 71 , ' 72 end 73 ' ) end if @DebugSwitch > 0 begin print @sqlpattern end declare @GenProcIDs_CounOrigin QBM_YCursorBuffer insert into @GenProcIDs_CounOrigin 74 (UID1) select distinct d.GenProcID from #QBMDeltaOrigin d select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount 75 begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CounOrigin bu where bu.ElementIndex = @ElementIndex exec QBM_PSessionContextSet 'GenProcID', 76@GenProcID select @SQLCmd = REPLACE(@SQLPattern, '@GenProcID', @GenProcID) if @DebugSwitch > 0 begin print @SQLCmd end exec QBM_PExecuteSQLWithRetry_LLP 77 @SQLStatement = @SQLcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = @MaxWaitTimeForMainOperation , @ProcIDForJournal = default , @HandleErrorSilent 78 = 0 select @ElementIndex += 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow 79() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R exec QBM_PSessionContextSet 'XUser' 80, @XUser_R return end
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:20:26.353
uses session context values has TRY/CATCH error handling
Summary: calls QBM_PSessionContextSet, QBM_PExecuteSQLWithRetry_LLP, QBM_PSessionErrorAdd; writes INSERT into; reads/joins DialogTable; uses session context XUser, GenProcID
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@TargetTable | varchar(30) | input |
@ElementColumn | varchar(30) | input |
@AssignedElementColumn | varchar(30) | input |
@RestrictionClause | nvarchar | input |
DML targets
INSERT intoRead/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: XUser GenProcID
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: #QBMDeltaOrigin
Variables: @TargetTable @ElementColumn @AssignedElementColumn @RestrictionClause @GenProcID @SQLCmd @SQLPattern @ExistsXIsInEffect @ExistsXdate @RestrictionClause_intern @DebugSwitch @IsCreatePendingChange @Maske @GenProcID_R @XUser_R @ElementCount @ElementIndex @MaxWaitTimeForMainOperation @procid @maske @sqlpattern @GenProcIDs_CounOrigin @ROWCOUNT @SQLStatement @SQLcmd @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @HandleErrorSilent @Rethrow
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.ADS_ZAccountInADSGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.ADS_ZADSMachineInADSGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.ADS_ZContactInADSGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.ADS_ZOrgHasADSGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA104261FA54379C6160FAE8F6 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA11AF8D16C61275A2DCFAED6E | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA32EFCA6201B15CB29D954994 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA6BF9FD71303E4D8F82AD2566 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA72A423016BA139FFC3D8EDFF | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PA98D6CE53656FFB7523357E71 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PACB9B89D5F903FDF8F2FAD40D | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PAD1085733B383217D4E3F0797 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PAD601362D0C4E22FD4721754B | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PAE14BB3C2EDA7D127BCA29F96 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PD0C461BCE9B1499A948C6DE89 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PD75EFC2994CF76773E86FDA0A | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PD7750F63D2FE88D966B93F426 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PD85D31B610579F7BE495D13A3 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PD88D54946ECC34815B5EF8AA7 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PDA305E8EEC3AE04AAA39FD671 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PDB81C19C7C55B5C62A0191559 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PDBB056A1F7CFF0CE82AAA3734 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PDBDCABA4BA9EB91B037DD3763 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.GEN_PDEC582A34382551F1DDFD9799 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.LDP_ZAccountInLDAPGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.LDP_ZLDPMachineInLDAPGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.LDP_ZOrgHasLDAPGroup | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZHelperHeadOrg | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZHelperHeadPerson | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZOrgHasQERAssign | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZOrgHasQERResource | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZOrgHasQERReuse | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZOrgHasQERReuseUS | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZPersonHasQERAssign | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZPersonHasQERResource | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZPersonHasQERReuse | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_ZPersonHasQERReuseUS | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RMS_ZESetHasEntitlement | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RMS_ZOrgHasESet | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RMS_ZPersonHasESet | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RMS_ZWorkDeskHasESet | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RPS_ZOrgHasRPSReport | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.RPS_ZPersonHasRPSReport | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZOrgHasTSBAccountDef | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZOrgHasUNSGroupB | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZOrgHasUNSGroupB1 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZOrgHasUNSGroupB2 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZOrgHasUNSGroupB3 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZPersonHasTSBAccountDef | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSAccountBHasUNSItemB | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSAccountBInUNSGroupB | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSAccountBInUNSGroupB1 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSAccountBInUNSGroupB2 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSAccountBInUNSGroupB3 | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.TSB_ZUNSGroupBHasUNSItemB | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.ADS_ZAccountInADSGroup | source text reference | has TRY/CATCH error handling |
| dbo.ADS_ZADSMachineInADSGroup | source text reference | has TRY/CATCH error handling |
| dbo.ADS_ZContactInADSGroup | source text reference | has TRY/CATCH error handling |
| dbo.ADS_ZOrgHasADSGroup | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.CPL_PComplianceCheckMakeProc_h | source text reference | has TRY/CATCH error handling |
| dbo.LDP_ZAccountInLDAPGroup | source text reference | has TRY/CATCH error handling |
| dbo.LDP_ZLDPMachineInLDAPGroup | source text reference | has TRY/CATCH error handling |
| dbo.LDP_ZOrgHasLDAPGroup | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.QER_PDynamicGroupMakeProc_hlp | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZHelperHeadOrg | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZHelperHeadPerson | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZOrgHasQERAssign | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.QER_ZOrgHasQERResource | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.QER_ZOrgHasQERReuse | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.QER_ZOrgHasQERReuseUS | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.QER_ZPersonHasQERAssign | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZPersonHasQERResource | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZPersonHasQERReuse | source text reference | has TRY/CATCH error handling |
| dbo.QER_ZPersonHasQERReuseUS | source text reference | has TRY/CATCH error handling |
| dbo.RMS_ZESetHasEntitlement | source text reference | has TRY/CATCH error handling |
| dbo.RMS_ZOrgHasESet | source text reference | has TRY/CATCH error handling |
| dbo.RMS_ZPersonHasESet | source text reference | has TRY/CATCH error handling |
| dbo.RMS_ZWorkDeskHasESet | source text reference | has TRY/CATCH error handling |
| dbo.RPS_ZOrgHasRPSReport | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.RPS_ZPersonHasRPSReport | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZOrgHasTSBAccountDef | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.TSB_ZOrgHasUNSGroupB | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.TSB_ZOrgHasUNSGroupB1 | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.TSB_ZOrgHasUNSGroupB2 | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.TSB_ZOrgHasUNSGroupB3 | source text reference | inserts DBQueue tasks, has TRY/CATCH error handling |
| dbo.TSB_ZPersonHasTSBAccountDef | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSAccountBHasUNSItemB | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSAccountBInUNSGroupB | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSAccountBInUNSGroupB1 | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSAccountBInUNSGroupB2 | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSAccountBInUNSGroupB3 | source text reference | has TRY/CATCH error handling |
| dbo.TSB_ZUNSGroupBHasUNSItemB | source text reference | has TRY/CATCH error handling |