Back to OIM Explorer

dbo.QBM_PMultilanguageFillSQL

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 4.004 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_FCVStringToList source text reference
  • references source dbo.QBM_FCVStringToListSQLMorphem source text reference
  • references source dbo.QBM_FCVElementToObjectKey1 source text reference
  • references source dbo.QBM_FCVStringToGUID source text reference
  • references source dbo.QBM_FCVStringTrimLDSPrefix source text reference
  • references source dbo.QBM_FCVStringTrimLeft source text reference
  • references source dbo.QBM_FCVStringTrimRight source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PMultilanguageFill source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL155 lines
1CREATE PROCEDURE QBM_PMultilanguageFillSQL(2  @Modulename varchar(3)3)4AS5BEGIN6  DECLARE @uid_dialogColumn varchar(38) = 'QBM-7262717EE68049A9BE2EEB30C6EC408B'7  DECLARE @uid_DefaultCulture varchar(38)8  DECLARE @XUser nvarchar(64) = OBJECT_NAME(@@procid)9  DECLARE @XDate datetime = getutcdate()10  DECLARE @MLKeys TABLE(MLKey nvarchar(1024) collate database_default)11  DECLARE @DebugSwitch int = 012  DECLARE @CountRows int13  SET XACT_ABORT OFF14  BEGIN TRY15    SET nocount16      ON17    SELECT TOP 1 @uid_DefaultCulture = d.UID_DialogCultureDefault18    FROM DialogDatabase d19      WITH(readpast)20    WHERE21      d.IsMainDatabase = 122    INSERT INTO @MLKeys(MLKey)23    SELECT24      DISTINCT dbo.QBM_FCVStringTrimLDSPrefix(CASE25      WHEN ml.MLKey LIKE '%|%' THEN26      SUBSTRING(ml.mlKey, 1, charindex('|', ml.MLKey) -1)27    ELSE ml.MLKey28    END) AS MLKey29    FROM(30    SELECT31      dbo.QBM_FCVStringTrimRight(dbo.QBM_FCVStringTrimLeft(m.morphem, 'N''', 0), '''', 0) AS MLKey32    FROM(33    SELECT z.Zeile34    FROM(35    SELECT36      dbo.QBM_FCVStringTrimRight(dbo.QBM_FCVStringTrimLeft(e.ParameterValue, NCHAR(13) + nchar(10) + nchar(9) + ' ',37      0), NCHAR(13) + nchar(10) + nchar(9) + ' ', 0) AS Zeile38    FROM sys.objects o39    JOIN sys.sql_modules m40      ON m.object_id = o.object_id CROSS apply dbo.QBM_FCVStringToList(m.definition, nchar(13), 1, 0) e41    WHERE42      o.type IN('TR', 'P', 'FN', 'IF') AND o.name LIKE @Modulename + '%') AS z43    WHERE44      z.Zeile NOT LIKE '--%' AND z.Zeile LIKE '%' + '#' + 'L' + 'D' + 'S' + '#' + '%') AS y CROSS apply dbo.QBM_FCVStringToListSQLMorphem(y.Zeile45    , 0, 0) m46    WHERE47      m.MorphemType = 'Literal' AND m.MorphemSubType = 'String' AND(m.morphem LIKE '''#' + 'L' + 'D' + 'S' + '#' + '%' OR m.morphem LIKE 'N''#'48    + 'L' + 'D' + 'S' + '#' + '%')) AS ml49    IF @DebugSwitch > 050    BEGIN51      SELECT *52      FROM @MLKeys53    END54    INSERT INTO QBMTranslationAddOnSource(UID_QBMTranslationAddOnSource,55    EntryKey,56    XDateInserted,57    XDateUpdated,58    XUserInserted,59    XUserUpdated,60    XObjectKey,61    SourceType)62    SELECT63      f.UID_QBMTranslationAddOnSource,64      f.MLKey,65      @XDate,66      @XDate,67      @XUser,68      @XUser,69      dbo.QBM_FCVElementToObjectKey1('QBMTranslationAddOnSource',70      'UID_QBMTranslationAddOnSource',71      f.UID_QBMTranslationAddOnSource),72      'DbProcessor'73    FROM(74    SELECT75      dbo.QBM_FCVStringToGUID(@Modulename, dbo.QBM_FCVStringTrimLDSPrefix(x.MLKey)) AS UID_QBMTranslationAddOnSource,76      x.MLKey77    FROM @MLKeys x78    WHERE79      NOT EXISTS(80    SELECT TOP 1 181    FROM QBMTranslationAddOnSource m82    WHERE83      m.Entrykey = x.MLKey collate SQL_Latin1_General_CP1_CS_AS)) AS f84    WHERE85      NOT EXISTS(86    SELECT TOP 1 187    FROM QBMTranslationAddOnSource y88    WHERE89      y.UID_QBMTranslationAddOnSource = f.UID_QBMTranslationAddOnSource)90    SELECT @CountRows = @@ROWCOUNT91    IF @DebugSwitch > 092    BEGIN93      print 'Lines into QBMTranslationAddOnSource' + str(@CountRows)94    END95    INSERT INTO DialogMultiLanguage(UID_DialogColumn,96    UID_DialogMultiLanguage,97    UID_DialogCulture,98    EntryKey,99    EntryValue,100    XDateInserted,101    XDateUpdated,102    XUserInserted,103    XUserUpdated,104    XObjectKey,105    SourceType)106    SELECT107      @uid_DialogColumn,108      f.UID_DialogMultiLanguage,109      @uid_DefaultCulture,110      f.MLKey,111      f.MLKey,112      @XDate,113      @XDate,114      @XUser,115      @XUser,116      dbo.QBM_FCVElementToObjectKey1('dialogmultilanguage',117      'UID_dialogmultilanguage',118      f.UID_DialogMultiLanguage),119      'DbProcessor'120    FROM(121    SELECT122      dbo.QBM_FCVStringToGUID(@Modulename, @uid_DialogColumn + @uid_DefaultCulture + dbo.QBM_FCVStringTrimLDSPrefix(x.MLKey)) AS UID_DialogMultiLanguage123      ,124      x.MLKey125    FROM @MLKeys x126    WHERE127      NOT EXISTS(128    SELECT TOP 1 1129    FROM DialogMultiLanguage m130    WHERE131      m.UID_DialogCulture = @uid_DefaultCulture AND m.uid_DialogColumn = @uid_DialogColumn AND m.Entrykey = x.MLKey collate SQL_Latin1_General_CP1_CS_AS132    )) AS f133    WHERE134      NOT EXISTS(135    SELECT TOP 1 1136    FROM DialogMultiLanguage y137    WHERE138      y.UID_DialogMultiLanguage = f.UID_DialogMultiLanguage)139    SELECT @CountRows = @@ROWCOUNT140    IF @DebugSwitch > 0141    BEGIN142      print 'Lines into DialogMultiLanguage' + str(@CountRows)143    END144  END TRY145  BEGIN CATCH146    EXEC QBM_PSessionErrorAdd DEFAULT147    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()148    RAISERROR(@Rethrow,149    18,150    1)151      WITH NOWAIT152  END CATCH153  ende:154  RETURN155END
Open raw exported source
SQL ยท Raw27 lines
1     create   procedure QBM_PMultilanguageFillSQL (@Modulename varchar(3)) as begin declare @uid_dialogColumn varchar(38) = 'QBM-7262717EE68049A9BE2EEB30C6EC408B'2 declare @uid_DefaultCulture varchar(38) declare @XUser nvarchar(64) = OBJECT_NAME(@@procid) declare @XDate datetime = getutcdate() declare @MLKeys table3 (MLKey nvarchar(1024) collate database_default) declare @DebugSwitch int = 0 declare @CountRows int SET XACT_ABORT OFF BEGIN TRY set nocount on select4 top 1 @uid_DefaultCulture = d.UID_DialogCultureDefault from DialogDatabase d with (readpast) where d.IsMainDatabase = 1 insert into @MLKeys(MLKey) select5 distinct dbo.QBM_FCVStringTrimLDSPrefix(case when ml.MLKey like '%|%' then SUBSTRING(ml.mlKey, 1, charindex('|', ml.MLKey) -1) else ml.MLKey end) as MLKey6 from ( select dbo.QBM_FCVStringTrimRight( dbo.QBM_FCVStringTrimLeft(m.morphem, 'N''', 0), '''', 0) as MLKey from ( select z.Zeile from ( select dbo.QBM_FCVStringTrimRight7(dbo.QBM_FCVStringTrimLeft(e.ParameterValue, NCHAR(13) + nchar(10) + nchar(9) + ' ', 0) , NCHAR(13) + nchar(10) + nchar(9) + ' ', 0) as Zeile from sys.objects8 o join sys.sql_modules m on m.object_id = o.object_id cross apply dbo.QBM_FCVStringToList(m.definition, nchar(13), 1, 0) e where o.type in ('TR', 'P',9 'FN', 'IF') and o.name like @Modulename + '%' ) as z where z.Zeile not like '--%' and z.Zeile like '%' + '#' + 'L' + 'D' + 'S' + '#' + '%' ) as y cross10 apply dbo.QBM_FCVStringToListSQLMorphem(y.Zeile, 0, 0) m where m.MorphemType = 'Literal' and m.MorphemSubType = 'String' and (m.morphem like '''#' + 'L'11 + 'D' + 'S' + '#' + '%' or m.morphem like 'N''#' + 'L' + 'D' + 'S' + '#' + '%' ) ) as ml if @DebugSwitch > 0 begin select * from @MLKeys end  insert into12 QBMTranslationAddOnSource (UID_QBMTranslationAddOnSource, EntryKey , XDateInserted , XDateUpdated , XUserInserted , XUserUpdated , XObjectKey , SourceType13 ) select f.UID_QBMTranslationAddOnSource, f.MLKey , @XDate, @XDate, @XUser, @XUser , dbo.QBM_FCVElementToObjectKey1('QBMTranslationAddOnSource', 'UID_QBMTranslationAddOnSource'14, f.UID_QBMTranslationAddOnSource) , 'DbProcessor' from ( select dbo.QBM_FCVStringToGUID( @Modulename, dbo.QBM_FCVStringTrimLDSPrefix(x.MLKey)) as UID_QBMTranslationAddOnSource15 ,x.MLKey from @MLKeys x where not exists (select top 1 1 from QBMTranslationAddOnSource m where m.Entrykey = x.MLKey collate SQL_Latin1_General_CP1_CS_AS16   ) ) as f where Not exists (select top 1 1 from QBMTranslationAddOnSource y where y.UID_QBMTranslationAddOnSource = f.UID_QBMTranslationAddOnSource )17 select @CountRows = @@ROWCOUNT if @DebugSwitch > 0 begin print 'Lines into QBMTranslationAddOnSource' + str(@CountRows) end  insert into DialogMultiLanguage18 ( UID_DialogColumn , UID_DialogMultiLanguage , UID_DialogCulture, EntryKey , EntryValue , XDateInserted , XDateUpdated , XUserInserted , XUserUpdated 19, XObjectKey , SourceType ) select @uid_DialogColumn , f.UID_DialogMultiLanguage, @uid_DefaultCulture, f.MLKey, f.MLKey , @XDate, @XDate, @XUser, @XUser20 , dbo.QBM_FCVElementToObjectKey1('dialogmultilanguage', 'UID_dialogmultilanguage', f.UID_DialogMultiLanguage) , 'DbProcessor' from ( select dbo.QBM_FCVStringToGUID21( @Modulename, @uid_DialogColumn + @uid_DefaultCulture + dbo.QBM_FCVStringTrimLDSPrefix(x.MLKey)) as UID_DialogMultiLanguage ,x.MLKey from @MLKeys x where22 not exists (select top 1 1 from DialogMultiLanguage m where m.UID_DialogCulture = @uid_DefaultCulture and m.uid_DialogColumn = @uid_DialogColumn and m.Entrykey23 = x.MLKey collate SQL_Latin1_General_CP1_CS_AS   ) ) as f where Not exists (select top 1 1 from DialogMultiLanguage y where y.UID_DialogMultiLanguage 24= f.UID_DialogMultiLanguage ) select @CountRows = @@ROWCOUNT if @DebugSwitch > 0 begin print 'Lines into DialogMultiLanguage' + str(@CountRows) end END25 TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT26 END CATCH ende:  return end 27