Back to OIM Explorer

dbo.QBM_PMultilanguageFill

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.861 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_FCVElementToObjectKey1 source text reference
  • references source dbo.QBM_FCVStringToGUID source text reference
  • references source dbo.QBM_FGIBitPatternMultilanguage source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_FSQFunctionCallModuleOwner source text reference
  • references source dbo.QBM_PExecuteSQLWithRetry_LLP source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL106 lines
1CREATE PROCEDURE QBM_PMultilanguageFill(2  @ModuleName varchar(3)3)4AS5BEGIN6  DECLARE @UID_DialogCultureDefault varchar(38)7  DECLARE @MusterInsert nvarchar(max)8  DECLARE @MusterHinten nvarchar(max)9  DECLARE @SQLCmd nvarchar(max)10  DECLARE @DebugSwitch int = 011  SET XACT_ABORT OFF12  BEGIN TRY13    SELECT TOP 1 @UID_DialogCultureDefault = d.UID_DialogCultureDefault14    FROM DialogDatabase d15      WITH(readpast)16    WHERE17      d.IsMainDatabase = 118    SELECT19      @MusterInsert = N '20	 insert into DialogMultiLanguage (UID_DialogMultiLanguage, UID_DialogColumn, EntryKey, EntryValue, UID_DialogCulture, XDateInserted, XUserInserted21						, XObjectKey22						, SourceType23						)24			select 25				y.UID_DialogMultiLanguage26			, y.UID_DialogColumn , y.prop, y.prop, '''27      + @UID_DialogCultureDefault + ''', getutcdate(), ''FillDefaults''28			, dbo.QBM_FCVElementToObjectKey1(''dialogmultilanguage'', ''UID_dialogmultilanguage'',  y.UID_DialogMultiLanguage)29			, ''Data''30			from 31			 (32						'33    SELECT34      @MusterHinten = '35			) as y3637	where Not exists (select top 1 1 38					from DialogMultiLanguage m39					where m.UID_DialogColumn = y.UID_DialogColumn40						and m.EntryKey = y.prop41					)42'43    SELECT44      @SQLCmd = string_agg(CONCAT(convert(nvarchar(max), ''), '45				select convert(nvarchar(max), t.',46      x.ColumnName, ') as prop, dbo.QBM_FCVStringToGUID( ''', @ModuleName, ''',  ''', x.UID_DialogColumn, ''' + ''',47      @UID_DialogCultureDefault, ''' +  convert(nvarchar(max), t.', x.ColumnName, ')) as UID_DialogMultiLanguage48					, ''',49      x.UID_DialogColumn, ''' as UID_DialogColumn50				from ', x.TableName, ' t51				where ', dbo.QBM_FSQFunctionCallModuleOwner(x.TableName,52      't'), ' = ''', @ModuleName, '''53					and convert(nvarchar(max), t.', x.ColumnName, ') > '' ''54			'),55      '56					union57					') within58      GROUP(59    ORDER BY x.TableName,60    x.columnname)61    FROM(62    SELECT63      c.UID_DialogColumn,64      t.TableName,65      c.ColumnName66    FROM DialogColumn c67      WITH(readpast)68    JOIN DialogTable t69      WITH(readpast)70      ON c.UID_DialogTable = t.UID_DialogTable71    WHERE72      c.Multilanguageflag & dbo.QBM_FGIBitPatternMultilanguage('|Source|Multivalent|', 0) = dbo.QBM_FGIBitPatternMultilanguage('|Source|',73    0) AND isnull(c.syntaxtype, '') <> 'Text.Dollar' AND EXISTS(74    SELECT TOP 1 175    FROM DialogColumn cv76      WITH(readpast)77    WHERE78      cv.UID_DialogTable = t.UID_DialogTable AND cv.ColumnName = 'XObjectKey')) AS x79    IF @SQLCmd > ' '80    BEGIN81      SELECT82        @SQLCmd = CONCAT(@MusterInsert,83        @SQLCmd,84        @MusterHinten)85      IF @DebugSwitch > 086      BEGIN87        SELECT @SQLCmd88      END89      EXEC QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLCmd,90        @LockTimeout_ms = DEFAULT,91        @MaxWaitTimeForLock_s = DEFAULT,92        @ProcIDForJournal = DEFAULT,93        @HandleErrorSilent = 094    END95  END TRY96  BEGIN CATCH97    EXEC QBM_PSessionErrorAdd DEFAULT98    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()99    RAISERROR(@Rethrow,100    18,101    1)102      WITH NOWAIT103  END CATCH104  ende:105  RETURN106END
Open raw exported source
SQL ยท Raw45 lines
1   create   procedure QBM_PMultilanguageFill (@ModuleName varchar(3) ) as begin declare @UID_DialogCultureDefault varchar(38) declare @MusterInsert2 nvarchar(max) declare @MusterHinten nvarchar(max) declare @SQLCmd nvarchar(max) declare @DebugSwitch int = 0 SET XACT_ABORT OFF BEGIN TRY select top 13 @UID_DialogCultureDefault = d.UID_DialogCultureDefault from DialogDatabase d with (readpast) where d.IsMainDatabase = 1 select @MusterInsert = N'4	 insert into DialogMultiLanguage (UID_DialogMultiLanguage, UID_DialogColumn, EntryKey, EntryValue, UID_DialogCulture, XDateInserted, XUserInserted5						, XObjectKey6						, SourceType7						)8			select 9				y.UID_DialogMultiLanguage10			, y.UID_DialogColumn , y.prop, y.prop, '''11 + @UID_DialogCultureDefault + ''', getutcdate(), ''FillDefaults''12			, dbo.QBM_FCVElementToObjectKey1(''dialogmultilanguage'', ''UID_dialogmultilanguage'',  y.UID_DialogMultiLanguage)13			, ''Data''14			from 15			 (16						'17 select @MusterHinten = '18			) as y1920	where Not exists (select top 1 1 21					from DialogMultiLanguage m22					where m.UID_DialogColumn = y.UID_DialogColumn23						and m.EntryKey = y.prop24					)25'26 select @SQLCmd = string_agg( concat (convert(nvarchar(max), ''), '27				select convert(nvarchar(max), t.', x.ColumnName, ') as prop, dbo.QBM_FCVStringToGUID( '''28, @ModuleName, ''',  ''', x.UID_DialogColumn, ''' + ''', @UID_DialogCultureDefault, ''' +  convert(nvarchar(max), t.', x.ColumnName, ')) as UID_DialogMultiLanguage29					, '''30, x.UID_DialogColumn, ''' as UID_DialogColumn31				from ', x.TableName, ' t32				where ', dbo.QBM_FSQFunctionCallModuleOwner(x.TableName, 't') , ' = '''33, @ModuleName, '''34					and convert(nvarchar(max), t.', x.ColumnName, ') > '' ''35			' )  ,  '36					union37					' )  within group(order by x.TableName38, x.columnname) from (select c.UID_DialogColumn, t.TableName, c.ColumnName from DialogColumn c with (readpast) join DialogTable t with (readpast) on c.UID_DialogTable39 = t.UID_DialogTable where c.Multilanguageflag & dbo.QBM_FGIBitPatternMultilanguage('|Source|Multivalent|', 0) = dbo.QBM_FGIBitPatternMultilanguage('|Source|'40, 0)  and isnull(c.syntaxtype, '') <> 'Text.Dollar' and exists (Select top 1 1 from DialogColumn cv with (readpast) where cv.UID_DialogTable = t.UID_DialogTable41 and cv.ColumnName = 'XObjectKey' )  ) as x if @SQLCmd > ' ' begin select @SQLCmd = concat( @MusterInsert , @SQLCmd , @MusterHinten ) if @DebugSwitch >42 0 begin select @SQLCmd end exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLCmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal43 = default , @HandleErrorSilent = 0 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow44() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: return end 45