Back to OIM Explorer

dbo.QER_PMNTableAddViewProperties

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.806 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.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QER_FGIOrgRootName source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL75 lines
1CREATE PROCEDURE QER_PMNTableAddViewProperties(2  @BaseTableMN varchar(30)3)4AS5BEGIN6  DECLARE @DebugSwitch int = 07  SET XACT_ABORT OFF8  BEGIN TRY9    IF EXISTS(10      SELECT TOP 1 111      FROM #QBMDeltaInsert)12    BEGIN13      UPDATE #QBMDeltaInsert14      SET TargetTableView = tv.TableName,15      ElementColumnView = rel.ChildColumn,16      AssignedElementColumnView = c.ColumnName17      FROM #QBMDeltaInsert i18      JOIN BaseTree b19        ON i.Element = b.UID_Org20      JOIN DialogTable tb21        WITH(readpast)22        ON tb.TableName = @BaseTableMN23      JOIN DialogTable tv24        WITH(readpast)25        ON tv.UID_DialogTableBase = tb.UID_DialogTable26      JOIN QBM_VQBMRelation rel27        ON rel.ChildTable = tv.TableName AND rel.ParentTable = dbo.QER_FGIOrgRootName(b.uid_orgroot)28      JOIN DialogColumn c29        WITH(readpast)30        ON c.UID_DialogTable = tv.UID_DialogTable AND c.IsPKMember = 1 AND c.ColumnName <> rel.ChildColumn31      IF @DebugSwitch > 032      BEGIN33        SELECT *34        FROM #QBMDeltaInsert35      END36    END37    IF EXISTS(38      SELECT TOP 1 139      FROM #QBMDeltaDelete)40    BEGIN41      UPDATE #QBMDeltaDelete42      SET TargetTableView = tv.TableName,43      ElementColumnView = rel.ChildColumn,44      AssignedElementColumnView = c.ColumnName45      FROM #QBMDeltaDelete i46      JOIN BaseTree b47        ON i.Element = b.UID_Org48      JOIN DialogTable tb49        WITH(readpast)50        ON tb.TableName = @BaseTableMN51      JOIN DialogTable tv52        WITH(readpast)53        ON tv.UID_DialogTableBase = tb.UID_DialogTable54      JOIN QBM_VQBMRelation rel55        ON rel.ChildTable = tv.TableName AND rel.ParentTable = dbo.QER_FGIOrgRootName(b.uid_orgroot)56      JOIN DialogColumn c57        WITH(readpast)58        ON c.UID_DialogTable = tv.UID_DialogTable AND c.IsPKMember = 1 AND c.ColumnName <> rel.ChildColumn59      IF @DebugSwitch > 060      BEGIN61        SELECT *62        FROM #QBMDeltaDelete63      END64    END65  END TRY66  BEGIN CATCH67    EXEC QBM_PSessionErrorAdd DEFAULT68    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()69    RAISERROR(@Rethrow,70    18,71    1)72      WITH NOWAIT73  END CATCH74  endLabel:75END
Open raw exported source
SQL ยท Raw13 lines
1   create   procedure QER_PMNTableAddViewProperties (@BaseTableMN varchar(30)) as begin declare @DebugSwitch int = 0 SET XACT_ABORT OFF BEGIN TRY2 if exists (select top 1 1 from #QBMDeltaInsert ) begin update #QBMDeltaInsert set TargetTableView = tv.TableName , ElementColumnView = rel.ChildColumn3 , AssignedElementColumnView = c.ColumnName from #QBMDeltaInsert i join BaseTree b on i.Element = b.UID_Org join DialogTable tb with (readpast) on tb.TableName4 = @BaseTableMN join DialogTable tv with (readpast) on tv.UID_DialogTableBase = tb.UID_DialogTable join QBM_VQBMRelation rel on rel.ChildTable = tv.TableName5 and rel.ParentTable = dbo.QER_FGIOrgRootName(b.uid_orgroot) join DialogColumn c with (readpast) on c.UID_DialogTable = tv.UID_DialogTable and c.IsPKMember6 = 1 and c.ColumnName <> rel.ChildColumn if @DebugSwitch > 0 begin select * from #QBMDeltaInsert end end if exists (select top 1 1 from #QBMDeltaDelete7 ) begin update #QBMDeltaDelete set TargetTableView = tv.TableName , ElementColumnView = rel.ChildColumn , AssignedElementColumnView = c.ColumnName from8 #QBMDeltaDelete i join BaseTree b on i.Element = b.UID_Org join DialogTable tb with (readpast) on tb.TableName = @BaseTableMN join DialogTable tv with9 (readpast) on tv.UID_DialogTableBase = tb.UID_DialogTable join QBM_VQBMRelation rel on rel.ChildTable = tv.TableName and rel.ParentTable = dbo.QER_FGIOrgRootName10(b.uid_orgroot) join DialogColumn c with (readpast) on c.UID_DialogTable = tv.UID_DialogTable and c.IsPKMember = 1 and c.ColumnName <> rel.ChildColumn 11if @DebugSwitch > 0 begin select * from #QBMDeltaDelete end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = 12dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: end 13