Back to OIM Explorer

dbo.QBM_PBufferT_ProcessUpdate

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 10.427 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_FCVObjectKeyToModuleOwner source text reference
  • references source dbo.QBM_FCVStringToIndent source text reference
  • references source dbo.QBM_FGIColumnExists source text reference
  • references source dbo.QBM_FGIColumnExistsInSchema source text reference
  • references source dbo.QBM_FGIColumnFitsContentShort source text reference
  • references source dbo.QBM_FGIDBOwner source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_FSQColumnCollationClause source text reference
  • references source dbo.QBM_FSQCVBufferToColumn source text reference
  • references source dbo.QBM_FSQCVColumnToBuffer source text reference
  • references source dbo.QBM_FSQIsNullClauseCmp source text reference
  • references source dbo.QBM_PJournal source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PTriggersInactiveForTable source text reference

Complete Source

SQL349 lines
1CREATE PROCEDURE QBM_PBufferT_ProcessUpdate(2  @ModuleName varchar(3),3  @TableName varchar(30),4  @columnname varchar(30)5)6AS7BEGIN8  DECLARE @DebugLevel char(1) = 'W'9  DECLARE @DebugSwitch int = 010  DECLARE @ColumnFitsToShort BIT11  DECLARE @IsCustomConfigurable BIT12  DECLARE @IsPKMember BIT13  DECLARE @DatabaseOwner varchar(3)14  DECLARE @xclause nvarchar(1000)15  DECLARE @SQLCmd nvarchar(max) = ''16  DECLARE @ErrorMessage nvarchar(4000)17  DECLARE @ErrorSeverity int18  DECLARE @ErrorState int19  DECLARE @CountRowsAffected int = 020  DECLARE @XUser nvarchar(64) = object_name(@@procid)21  DECLARE @UPD_BC_SHORT nvarchar(max) = CONCAT('22	-- code from @UPD_BC_SHORT23		update QBMBufferConfig 24			set ContentShort = du.ContentShort25			, HasContentFull = 0 '26  ,27  CONCAT('', '	--3410128				, XDateUpdated = getutcdate()29				, XUserUpdated = ''', object_name(@@procid),30  '''31				'),32  ' from QBMBufferConfig bc join #QBMBufferTransferOneTable du on bc.TableName = ''@TableName@'' 33														and bc.Columnname = ''@columnname@''34														and du.ColumnName = ''@columnname@''35														and bc.ObjectKeyOfRow = du.ObjectKeyOfRow collate Database_default36			where (isnull(bc.ContentShort, N'''') <> isnull(du.ContentShort, N'''')  @Collation@37					)3839'40  )41  DECLARE @UPD_BC_LONG nvarchar(max) = CONCAT('42	-- code from @UPD_BC_LONG43		update QBMBufferConfig 44			set ContentShort = du.ContentShort45			, HasContentFull = du.HasContentFull46			, ContentFull = du.ContentFull '47  ,48  CONCAT('', '	--3410149				, XDateUpdated = getutcdate()50				, XUserUpdated = ''', object_name(@@procid),51  '''52				'),53  '54			from QBMBufferConfig bc join #QBMBufferTransferOneTable du on bc.TableName = ''@TableName@'' 55														and bc.Columnname = ''@columnname@''56														and du.ColumnName = ''@columnname@''57														and bc.ObjectKeyOfRow = du.ObjectKeyOfRow collate Database_default58			where (isnull(bc.ContentShort, N'''') <> isnull(du.ContentShort, N'''') @Collation@59					or bc.HasContentFull <> du.HasContentFull60					or isnull(bc.ContentFull, N'''') <> isnull(du.ContentFull, N'''') @Collation@61					)6263'64  )65  DECLARE @UPD_ZE nvarchar(max) = CONCAT('66	-- code from @UPD_ZE67/*68		if exists (69					select top 1 170					from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable bu on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default71														and bu.columnname = ''@columnname@''72					where 73						@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@74				  )75		 begin76*/		 77			updat'78  ,79  'e @TableName@80				set @columnname@ = @ContentFromBuffer_bu@81				@Xclause@82			from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable bu on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default83												and bu.columnname = ''@columnname@''84			where 85				@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@86			@RowOwnerClause_bu@8788'89  )90  DECLARE @UPD_ZE_COND_BC nvarchar(max) = @UPD_ZE + '91	-- code from @UPD_ZE_COND_BC92			and not exists (93							select top 1 194							 from QBMBufferConfig cf with (readpast)95							where cf.TableName = ''@TableName@''96								and cf.ColumnName = ''@columnname@''97								and cf.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default98							)99'100  SELECT @UPD_ZE = @UPD_ZE + '101/*102		 end		 103*/		 104'105  SELECT @UPD_ZE_COND_BC = @UPD_ZE_COND_BC + '106/*107		 end		 108*/		 109'110  DECLARE @DEL_BC_EQ nvarchar(max) = '111	-- code from @DEL_BC_EQ112		delete  QBMBufferConfig113		from QBMBufferConfig bu join @TableName@ zt on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default114											and bu.columnname = ''@columnname@''115											and bu.TableName = ''@TableName@''116		where 117			@IsnullClauseForTable_zt@ = @ContentBufferCompare_bu@ @Collation@118		'119  DECLARE @DEL_BC nvarchar(max) = '120	-- code from @DEL_BC121		delete QBMBufferConfig 122			from QBMBufferConfig bc join #QBMBufferTransferOneTable bu on bc.TableName = ''@TableName@'' 123														and bc.Columnname = ''@columnname@''124														and bu.ColumnName = ''@columnname@''125														and bc.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default126			@RowOwnerClause_bu@127128'129  DECLARE @COPY_BC nvarchar(max) = CONCAT('130	-- code from @COPY_BC131			inser',132  't into QBMBufferConfig (UID_QBMBufferConfig, TableName, ColumnName, ObjectKeyOfRow, ContentShort, HasContentFull, ContentFull, XDateInserted, XDateUpdated, XUserInserted, XUserUpdated)133				select newid(), ''@TableName@'', ''@columnname@'', bu.ObjectKeyOfRow, @ZelleZuPuffer@, getutcdate(), getutcdate(), '''134  ,135  object_name(@@procid),136  ''', ''',137  object_name(@@procid),138  '''139				from #QBMBufferTransferOneTable bu join @TableName@ zt on bu.ObjectKeyOfRow = zt.XObjectKey  collate Database_default140																	and bu.ColumnName = ''@columnname@''141				where Not exists (select top 1 1 142									 from QBMBufferConfig cb with (readpast)143										where cb.TableName = ''@TableName@''144										 and cb.columnname = ''@columnname@''145										 and cb.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default146									) 147				@RowOwnerClause_bu@148'149  )150  DECLARE @RESTORE_BC nvarchar(max) = CONCAT('151	-- code from @RESTORE_BC152			updat',153  'e @TableName@154				set @columnname@ = @ContentFromBuffer_bu@155				@Xclause@156			from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable z on zt.XObjectKey = z.ObjectkeyOfRow collate Database_default157												and z.columnname = ''@columnname@''158							join QBMBufferConfig bu with (readpast) on bu.columnname = ''@columnname@''159													and bu.TableName = ''@TableName@''160													and bu.ObjectkeyOfRow = z.ObjectkeyOfRow collate Database_default161			where 162				@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@163			@RowOwnerClause_bu@164165'166  )167  SET XACT_ABORT OFF168  BEGIN TRY169    SELECT170      TOP 1 @IsCustomConfigurable = sign(max(convert(int, x.IsCustomConfigurable))),171      @IsPKMember = sign(max(convert(int, x.IsPKMember)))172    FROM(173    SELECT174      c.IsCustomConfigurable,175      c.IsPKMember176    FROM DialogColumn c177      WITH(readpast)178    JOIN DialogTable t179      WITH(readpast)180      ON c.UID_DialogTable = t.UID_DialogTable181    WHERE182      t.TableName = @TableName AND c.ColumnName = @columnname AND t.TableType = 'T'183    UNION184    SELECT185      cv.IsCustomConfigurable,186      cb.IsPKMember187    FROM DialogColumn cv188      WITH(readpast)189    JOIN DialogTable v190      WITH(readpast)191      ON cv.UID_DialogTable = v.UID_DialogTable192    JOIN DialogTable b193      WITH(readpast)194      ON v.UID_DialogTableBase = b.UID_DialogTable195    JOIN DialogColumn cb196      WITH(readpast)197      ON b.UID_DialogTable = cb.UID_DialogTable AND cv.UID_BaseColumn = cb.UID_DialogColumn198    WHERE199      b.TableName = @TableName AND b.TableType IN('B') AND v.TableType IN('V') AND cb.ColumnName = @columnname200    UNION201    SELECT202      0,203      0) AS x204    SELECT @DatabaseOwner = dbo.QBM_FGIDBOwner()205    IF @IsPKMember = 1206    BEGIN207      IF @DebugSwitch > 0208      BEGIN209        print 'PK - Member angesprochen'210      END211      GOTO EndLabel212    END213    SELECT214      @ColumnFitsToShort = dbo.QBM_FGIColumnFitsContentShort(@TableName,215      @columnname)216    IF @ModuleName = 'CCC' AND @DatabaseOwner <> 'CCC'217    BEGIN218      IF @DebugSwitch > 0219      BEGIN220        print 'Kundenmaterial in Master-DB darf nicht rein'221      END222      GOTO endlabel223    END224    IF dbo.QBM_FGIColumnExistsInSchema(@TableName,225    'XDateUpdated') = 1 AND @columnname NOT LIKE 'X[d,u][a,s][t,e][e,r]updated'226    BEGIN227      SELECT228        @xclause = ', XUserupdated = ''' + @xuser + ''' , xdateupdated = getutcdate()'229    END230    ELSE231    BEGIN232      SELECT @xclause = '--'233    END234    IF @ModuleName <> 'CCC' AND @IsCustomConfigurable = 1 AND @DatabaseOwner = 'CCC'235    BEGIN236      IF @ColumnFitsToShort = 1237      BEGIN238        IF @DebugSwitch > 0 print 'Modul <> CCC, customconfigurable = 1 , owner = CCC , fitToShort'239        SELECT @SQLCmd = @UPD_BC_SHORT240      END241      ELSE242      BEGIN243        IF @DebugSwitch > 0 print 'Modul <> CCC, customconfigurable = 1 , owner = CCC , no fitToShort'244        SELECT @SQLCmd = @UPD_BC_LONG245      END246      SELECT @SQLCmd = @SQLCmd + @UPD_ZE_COND_BC + @DEL_BC_EQ247    END248    IF @ModuleName <> 'CCC' AND(@IsCustomConfigurable = 0 OR @DatabaseOwner <> 'CCC')249    BEGIN250      IF @DebugSwitch > 0 print 'Modul <> CCC, customconfigurable = 0 oder owner <> CCC '251      SELECT @SQLCmd = @UPD_ZE + @DEL_BC252    END253    IF @ModuleName <> 'CCC'254    BEGIN255      SELECT256        @SQLCmd = REPLACE(@sqlcmd,257        '@RowOwnerClause_bu@',258        '--')259    END260    IF @ModuleName = 'CCC'261    BEGIN262      IF @IsCustomConfigurable = 1263      BEGIN264        IF @DebugSwitch > 0 print 'Modul = CCC, customconfigurable = 1 und owner = CCC '265        SELECT @SQLCmd = @COPY_BC + @UPD_ZE + @DEL_BC_EQ266        SELECT267          @SQLCmd = REPLACE(@SQLCmd,268          '@RowOwnerClause_bu@',269          ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) <> ''CCC''')270      END271      ELSE272      BEGIN273        IF @DebugSwitch > 0 print 'Modul = CCC, customconfigurable = 0 und owner = CCC '274        SELECT @SQLCmd = @RESTORE_BC + @DEL_BC275        SELECT276          @SQLCmd = REPLACE(@SQLCmd,277          '@RowOwnerClause_bu@',278          ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) <> ''CCC''')279      END280      SELECT @SQLCmd = @SQLCmd + @UPD_ZE + @DEL_BC281      SELECT282        @SQLCmd = REPLACE(@SQLCmd,283        '@RowOwnerClause_bu@',284        ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) = ''CCC''')285    END286    SELECT287      @SQLCmd = REPLACE(@SQLCmd,288      '@IsnullClauseForTable_zt@',289      dbo.QBM_FCVStringToIndent(dbo.QBM_FSQIsNullClauseCmp(@TableName, @columnname, N 'zt'), 1))290    SELECT291      @SQLCmd = REPLACE(@SQLCmd,292      '@ContentFromBuffer_bu@',293      dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVBufferToColumn(@TableName, @columnname, N 'bu', 0), 8))294    SELECT295      @SQLCmd = REPLACE(@SQLCmd,296      '@ContentBufferCompare_bu@',297      dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVBufferToColumn(@TableName, @columnname, N 'bu', 1), 8))298    SELECT299      @SQLCmd = REPLACE(@SQLCmd,300      '@Xclause@',301      @Xclause)302    SELECT303      @SQLCmd = replace(REPLACE(@SQLCmd, '@TableName@', @TableName),304      '@columnname@',305      @columnname)306    SELECT307      @SQLCmd = REPLACE(@SQLCmd,308      '@Collation@',309      dbo.QBM_FSQColumnCollationClause(@TableName, @columnname))310    SELECT311      @SQLCmd = REPLACE(@SQLCmd,312      '@ZelleZuPuffer@',313      dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVColumnToBuffer(@TableName, @ColumnName, 'zt'), 8))314    IF @DebugSwitch > 0315    BEGIN316      print @SQLCmd317      EXEC QBM_PJournal @SQLCmd,318        @@procid,319      'D',320        @DebugLevel321    END322    BEGIN TRY323      EXEC sp_executesql @SQLCmd324      SELECT @CountRowsAffected = @@ROWCOUNT325    END TRY326    BEGIN CATCH327      EXEC QBM_PSessionErrorAdd DEFAULT,328        @SQLCmd329      RAISERROR('',330      18,331      1)332        WITH NOWAIT333    END CATCH334    IF @CountRowsAffected > 0335    BEGIN336      EXEC QBM_PTriggersInactiveForTable @TableName,337      'Update'338    END339  END TRY340  BEGIN CATCH341    EXEC QBM_PSessionErrorAdd DEFAULT342    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()343    RAISERROR(@Rethrow,344    18,345    1)346      WITH NOWAIT347  END CATCH348  endLabel:349END
Open raw exported source
SQL ยท Raw161 lines
1   create   procedure QBM_PBufferT_ProcessUpdate ( @ModuleName varchar(3) , @TableName varchar(30) , @columnname varchar(30) ) as begin declare 2@DebugLevel char(1) = 'W' declare @DebugSwitch int = 0 declare @ColumnFitsToShort bit declare @IsCustomConfigurable bit declare @IsPKMember bit declare3 @DatabaseOwner varchar(3) declare @xclause nvarchar(1000) declare @SQLCmd nvarchar(max) = '' declare @ErrorMessage nvarchar(4000) declare @ErrorSeverity4 int declare @ErrorState int declare @CountRowsAffected int = 0 declare @XUser nvarchar(64) = object_name(@@procid)  declare @UPD_BC_SHORT nvarchar(max5) = concat('6	-- code from @UPD_BC_SHORT7		update QBMBufferConfig 8			set ContentShort = du.ContentShort9			, HasContentFull = 0 ' , concat('' , '	--3410110				, XDateUpdated = getutcdate()11				, XUserUpdated = '''12, object_name(@@procid) , '''13				') ,' from QBMBufferConfig bc join #QBMBufferTransferOneTable du on bc.TableName = ''@TableName@'' 14														and bc.Columnname = ''@columnname@''15														and du.ColumnName = ''@columnname@''16														and bc.ObjectKeyOfRow = du.ObjectKeyOfRow collate Database_default17			where (isnull(bc.ContentShort, N'''') <> isnull(du.ContentShort, N'''')  @Collation@18					)1920'21 ) declare @UPD_BC_LONG nvarchar(max) = concat('22	-- code from @UPD_BC_LONG23		update QBMBufferConfig 24			set ContentShort = du.ContentShort25			, HasContentFull = du.HasContentFull26			, ContentFull = du.ContentFull '27 , concat('' , '	--3410128				, XDateUpdated = getutcdate()29				, XUserUpdated = ''', object_name(@@procid) , '''30				') ,'31			from QBMBufferConfig bc join #QBMBufferTransferOneTable du on bc.TableName = ''@TableName@'' 32														and bc.Columnname = ''@columnname@''33														and du.ColumnName = ''@columnname@''34														and bc.ObjectKeyOfRow = du.ObjectKeyOfRow collate Database_default35			where (isnull(bc.ContentShort, N'''') <> isnull(du.ContentShort, N'''') @Collation@36					or bc.HasContentFull <> du.HasContentFull37					or isnull(bc.ContentFull, N'''') <> isnull(du.ContentFull, N'''') @Collation@38					)3940'41 )  declare @UPD_ZE nvarchar(max) = concat('42	-- code from @UPD_ZE43/*44		if exists (45					select top 1 146					from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable bu on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default47														and bu.columnname = ''@columnname@''48					where 49						@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@50				  )51		 begin52*/		 53			updat'54,'e @TableName@55				set @columnname@ = @ContentFromBuffer_bu@56				@Xclause@57			from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable bu on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default58												and bu.columnname = ''@columnname@''59			where 60				@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@61			@RowOwnerClause_bu@6263'64 ) declare @UPD_ZE_COND_BC nvarchar(max) = @UPD_ZE + '65	-- code from @UPD_ZE_COND_BC66			and not exists (67							select top 1 168							 from QBMBufferConfig cf with (readpast)69							where cf.TableName = ''@TableName@''70								and cf.ColumnName = ''@columnname@''71								and cf.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default72							)73'74 select @UPD_ZE = @UPD_ZE + '75/*76		 end		 77*/		 78' select @UPD_ZE_COND_BC = @UPD_ZE_COND_BC + '79/*80		 end		 81*/		 82' declare @DEL_BC_EQ nvarchar83(max) = '84	-- code from @DEL_BC_EQ85		delete  QBMBufferConfig86		from QBMBufferConfig bu join @TableName@ zt on zt.XObjectKey = bu.ObjectkeyOfRow collate Database_default87											and bu.columnname = ''@columnname@''88											and bu.TableName = ''@TableName@''89		where 90			@IsnullClauseForTable_zt@ = @ContentBufferCompare_bu@ @Collation@91		'92 declare @DEL_BC nvarchar(max) = '93	-- code from @DEL_BC94		delete QBMBufferConfig 95			from QBMBufferConfig bc join #QBMBufferTransferOneTable bu on bc.TableName = ''@TableName@'' 96														and bc.Columnname = ''@columnname@''97														and bu.ColumnName = ''@columnname@''98														and bc.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default99			@RowOwnerClause_bu@100101'102 declare @COPY_BC nvarchar(max) = concat('103	-- code from @COPY_BC104			inser','t into QBMBufferConfig (UID_QBMBufferConfig, TableName, ColumnName, ObjectKeyOfRow, ContentShort, HasContentFull, ContentFull, XDateInserted, XDateUpdated, XUserInserted, XUserUpdated)105				select newid(), ''@TableName@'', ''@columnname@'', bu.ObjectKeyOfRow, @ZelleZuPuffer@, getutcdate(), getutcdate(), '''106, object_name(@@procid) ,''', ''', object_name(@@procid) ,'''107				from #QBMBufferTransferOneTable bu join @TableName@ zt on bu.ObjectKeyOfRow = zt.XObjectKey  collate Database_default108																	and bu.ColumnName = ''@columnname@''109				where Not exists (select top 1 1 110									 from QBMBufferConfig cb with (readpast)111										where cb.TableName = ''@TableName@''112										 and cb.columnname = ''@columnname@''113										 and cb.ObjectKeyOfRow = bu.ObjectKeyOfRow collate Database_default114									) 115				@RowOwnerClause_bu@116'117) declare @RESTORE_BC nvarchar(max) = concat('118	-- code from @RESTORE_BC119			updat','e @TableName@120				set @columnname@ = @ContentFromBuffer_bu@121				@Xclause@122			from @TableName@ zt with (readpast) join #QBMBufferTransferOneTable z on zt.XObjectKey = z.ObjectkeyOfRow collate Database_default123												and z.columnname = ''@columnname@''124							join QBMBufferConfig bu with (readpast) on bu.columnname = ''@columnname@''125													and bu.TableName = ''@TableName@''126													and bu.ObjectkeyOfRow = z.ObjectkeyOfRow collate Database_default127			where 128				@IsnullClauseForTable_zt@ <> @ContentBufferCompare_bu@ @Collation@129			@RowOwnerClause_bu@130131'132 ) SET XACT_ABORT OFF BEGIN TRY select top 1 @IsCustomConfigurable = sign(max(convert(int, x.IsCustomConfigurable))) , @IsPKMember = sign(max(convert(int133, x.IsPKMember))) from ( select c.IsCustomConfigurable, c.IsPKMember from DialogColumn c with (readpast) join DialogTable t with (readpast) on c.UID_DialogTable134 = t.UID_DialogTable where t.TableName = @TableName and c.ColumnName = @columnname and t.TableType = 'T' union select cv.IsCustomConfigurable, cb.IsPKMember135 from DialogColumn cv with (readpast) join DialogTable v with (readpast) on cv.UID_DialogTable = v.UID_DialogTable join DialogTable b with (readpast) on136 v.UID_DialogTableBase = b.UID_DialogTable join DialogColumn cb with (readpast) on b.UID_DialogTable = cb.UID_DialogTable and cv.UID_BaseColumn = cb.UID_DialogColumn137 where b.TableName = @TableName and b.TableType in ('B') and v.TableType in ('V') and cb.ColumnName = @columnname   union select 0, 0 ) as x select @DatabaseOwner138 = dbo.QBM_FGIDBOwner()  if @IsPKMember = 1 begin if @DebugSwitch > 0 begin print 'PK - Member angesprochen' end goto EndLabel end select @ColumnFitsToShort139 = dbo.QBM_FGIColumnFitsContentShort(@TableName , @columnname) if @ModuleName = 'CCC' and @DatabaseOwner <> 'CCC' begin if @DebugSwitch > 0 begin print140 'Kundenmaterial in Master-DB darf nicht rein' end goto endlabel end if dbo.QBM_FGIColumnExistsInSchema(@TableName, 'XDateUpdated') = 1 and @columnname141 not like 'X[d,u][a,s][t,e][e,r]updated' begin select @xclause = ', XUserupdated = ''' + @xuser + ''' , xdateupdated = getutcdate()' end else begin select142 @xclause = '--' end if @ModuleName <> 'CCC'  and @IsCustomConfigurable = 1 and @DatabaseOwner = 'CCC' begin    if @ColumnFitsToShort = 1 begin if @DebugSwitch143 > 0 print 'Modul <> CCC, customconfigurable = 1 , owner = CCC , fitToShort' select @SQLCmd = @UPD_BC_SHORT end else begin if @DebugSwitch > 0 print 'Modul <> CCC, customconfigurable = 1 , owner = CCC , no fitToShort'144 select @SQLCmd = @UPD_BC_LONG end select @SQLCmd = @SQLCmd + @UPD_ZE_COND_BC + @DEL_BC_EQ end if @ModuleName <> 'CCC'  and ( @IsCustomConfigurable = 0145 or @DatabaseOwner <> 'CCC' ) begin   if @DebugSwitch > 0 print 'Modul <> CCC, customconfigurable = 0 oder owner <> CCC ' select @SQLCmd = @UPD_ZE + @DEL_BC146 end  if @ModuleName <> 'CCC' begin select @SQLCmd = REPLACE(@sqlcmd, '@RowOwnerClause_bu@', '--') end  if @ModuleName = 'CCC' begin if @IsCustomConfigurable147 = 1 begin      if @DebugSwitch > 0 print 'Modul = CCC, customconfigurable = 1 und owner = CCC ' select @SQLCmd = @COPY_BC + @UPD_ZE + @DEL_BC_EQ select148 @SQLCmd = REPLACE(@SQLCmd, '@RowOwnerClause_bu@', ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) <> ''CCC''' ) end else begin     if @DebugSwitch149 > 0 print 'Modul = CCC, customconfigurable = 0 und owner = CCC ' select @SQLCmd = @RESTORE_BC + @DEL_BC select @SQLCmd = REPLACE(@SQLCmd, '@RowOwnerClause_bu@'150, ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) <> ''CCC''' ) end     select @SQLCmd = @SQLCmd + @UPD_ZE + @DEL_BC select @SQLCmd = REPLACE151(@SQLCmd, '@RowOwnerClause_bu@', ' and dbo.QBM_FCVObjectKeyToModuleOwner(bu.ObjectKeyOfRow) = ''CCC''' ) end   select @SQLCmd = REPLACE(@SQLCmd, '@IsnullClauseForTable_zt@'152, dbo.QBM_FCVStringToIndent( dbo.QBM_FSQIsNullClauseCmp(@TableName , @columnname, N'zt'), 1)) select @SQLCmd = REPLACE(@SQLCmd, '@ContentFromBuffer_bu@'153, dbo.QBM_FCVStringToIndent( dbo.QBM_FSQCVBufferToColumn(@TableName , @columnname, N'bu', 0), 8)) select @SQLCmd = REPLACE(@SQLCmd, '@ContentBufferCompare_bu@'154, dbo.QBM_FCVStringToIndent( dbo.QBM_FSQCVBufferToColumn(@TableName , @columnname, N'bu', 1), 8)) select @SQLCmd = REPLACE(@SQLCmd, '@Xclause@', @Xclause155)  select @SQLCmd = replace(REPLACE(@SQLCmd, '@TableName@', @TableName ) , '@columnname@', @columnname) select @SQLCmd = REPLACE(@SQLCmd, '@Collation@'156, dbo.QBM_FSQColumnCollationClause(@TableName , @columnname)) select @SQLCmd = REPLACE(@SQLCmd, '@ZelleZuPuffer@', dbo.QBM_FCVStringToIndent( dbo.QBM_FSQCVColumnToBuffer157(@TableName, @ColumnName, 'zt'), 8))  if @DebugSwitch > 0 begin print @SQLCmd exec QBM_PJournal @SQLCmd, @@procid, 'D', @DebugLevel end begin try exec 158sp_executesql @SQLCmd select @CountRowsAffected = @@ROWCOUNT end try begin catch exec QBM_PSessionErrorAdd default, @SQLCmd RAISERROR ('', 18, 1) WITH 159NOWAIT end catch if @CountRowsAffected > 0 begin exec QBM_PTriggersInactiveForTable @TableName, 'Update' end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd160 default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: end 161