dbo.QER_PSQRiskIndexGetUpdate
SQL_STORED_PROCEDURE
Created 2025-06-27T18:01:06.823 · modified 2026-04-14T23:20:39.387 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@uid_dialogcolumn | varchar | no |
@SQLProcedure | nvarchar | yes |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| dbo | DialogColumn | OBJECT_OR_COLUMN | |
| dbo | DialogTable | OBJECT_OR_COLUMN | |
| dbo | QBM_FGICodeName | OBJECT_OR_COLUMN | |
| dbo | QERRiskIndex | 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 QER_PSQRiskIndexGetUpdate( @uid_dialogcolumn varchar(38) , @SQLProcedure nvarchar(max) output ) as begin declare @targettable 2 nvarchar(32) declare @TargetColumn nvarchar(32) declare @UID_TargetTable varchar(38) declare @IsValidClause bit = 0 select top 1 @targettable = t.TableName 3 , @TargetColumn = c.ColumnName , @UID_TargetTable = c.UID_DialogTable from dbo.DialogColumn c with (readpast) join dbo.DialogTable t with (readpast) on 4 c.UID_DialogTable = t.UID_DialogTable where c.UID_DialogColumn = @UID_DialogColumn declare @IsToReduce bit declare @ColumnReduceBase nvarchar(32) select 5 @isToReduce = 0 select @ColumnReduceBase = N'' if @TargetColumn = 'RiskIndexReduced' begin select @isToReduce = 1 select top 1 @ColumnReduceBase = columnname 6 from dbo.DialogColumn c where columnname in ('RiskIndex', 'RiskIndexCalculated') and c.UID_DialogTable = @UID_TargetTable end declare @erg nvarchar(max 7) declare @body1 nvarchar(max) declare @body2 nvarchar(max) declare @HilfsViewName Nvarchar(64) = left(concat('TST_FTemporaryElement', reverse(dbo.QBM_FGICodeName 8('V', NEWID()) )), 30) if @isToReduce = 1 begin select @body1 =N' 9insert into #DeltaQERRiskIndex (XObjectKey, NewValue) 10 select z.XObjectKey, 11 12--update %TargetTable% 13-- set %TargetColumn% = case 14-- when ' 15 + @ColumnReduceBase + ' - y.SourceValue < 0.0 then 0.0 16-- when ' + @ColumnReduceBase + ' - y.SourceValue > 1.0 then 1.0 17-- else ' + @ColumnReduceBase 18 + ' - y.SourceValue 19-- end 20 21 case 22 when ' + @ColumnReduceBase + ' - y.SourceValue < 0.0 then 0.0 23 when ' + @ColumnReduceBase 24 + ' - y.SourceValue > 1.0 then 1.0 25 else ' + @ColumnReduceBase + ' - y.SourceValue 26 end as Newvalue 27 from %TargetTable% z with (readpast) /* hier bei 438165 Zugriff auf Elemente aus QBMDBQueueCurrent */ 28 join 29 ( 30 select x.ObjectKeyTarget , MAX(x.SourceValue) as SourceValue 31 ' 32 end else begin select @body1 =N' 33insert into #DeltaQERRiskIndex (XObjectKey, NewValue) 34 select z.XObjectKey, y.SourceValue 35 36--update %TargetTable% 37-- set %TargetColumn% = y.SourceValue 38 from %TargetTable% z with (readpast) /* hier bei 438165 Zugriff auf Elemente aus QBMDBQueueCurrent */ 39 join 40 ( 41 select x.ObjectKeyTarget , case 42 when sum(x.SourceValue) < 0.0 then 0.0 43 when sum(x.SourceValue) > 1.0 then 1.0 44 else sum(x.SourceValue) 45 end as SourceValue 46 ' 47 end select @body1 = @body1 + N' 48 from ( 49 -- common fallback clause 50 select XObjectKey as ObjectKeyTarget, 0.0 as SourceValue 51 from %TargetTable% with (readpast) /* hier bei 438165 Zugriff auf Elemente aus QBMDBQueueCurrent */ 52 -- / common fallback clause 53' 54 if @isToReduce = 1 begin select @body2 =N' 55 ) as x 56 group by x.ObjectKeyTarget 57 ) as y on z.XObjectKey = y.ObjectKeyTarget 58 where %TargetColumn% <> case 59 when ' 60 + @ColumnReduceBase + ' - y.SourceValue < 0.0 then 0.0 61 when ' + @ColumnReduceBase + ' - y.SourceValue > 1.0 then 1.0 62 else ' + @ColumnReduceBase 63 + ' - y.SourceValue 64 end 65 ' end else begin select @body2 =N' 66 ) as x 67 group by x.ObjectKeyTarget 68 ) as y on z.XObjectKey = y.ObjectKeyTarget 69 where z.%TargetColumn% <> y.SourceValue 70 ' 71 end declare @KernelPattern nvarchar(max) select @KernelPattern = N' 72 union all 73 /* 74 %DisplayValue% 75 */ 76 select v.ObjectKeyTarget, %TypeOfCalculation%(v.SourceValue) * (%Gewicht%) / (%GewichtSumme%) as SourceValue 77 from ( 78-- select '''' as ObjectKeyTarget, 0.0 as SourceValue 79-- union all ' 80 + N'
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:39.387
None extracted.
Summary: writes INSERT into; reads/joins DialogColumn, DialogTable, QERRiskIndex, INFORMATION_SCHEMA
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@uid_dialogcolumn | varchar(38) | input |
@SQLProcedure | nvarchar | OUTPUT |
DML targets
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: #DeltaQERRiskIndex #Selection
Variables: @uid_dialogcolumn @SQLProcedure @targettable @TargetColumn @UID_TargetTable @IsValidClause @UID_DialogColumn @IsToReduce @ColumnReduceBase @isToReduce @erg @body1 @body2 @HilfsViewName @KernelPattern @SelectMitConvert @SelectOhneConvert @SQLViewTest @KernelPattern2 @Kernel @SubKernel @UID_QERRiskIndex @Weight @QueryString @TypeOfCalculation @DisplayValue @Ersatz @SummeGewicht @uid_DialogColumn @weight @subKernel
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.QER_PQERRiskIndexMakeProc | SQL expression dependency | OBJECT_OR_COLUMN |
| dbo.QER_PQERRiskIndexMakeProc | source text reference | has TRY/CATCH error handling |