dbo.TSB_PMemberOfSplitToGroups
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
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_FCVElementToObjectKey2 source text reference
- references source dbo.QBM_FGIBitPatternXOrigin source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
- dbo.QBM_FCVStringToList
- dbo.QBM_FCVElementToObjectKey2
- dbo.QBM_FGIBitPatternXOrigin
- dbo.QBM_PSessionErrorAdd
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE TSB_PMemberOfSplitToGroups(2 @UID_UNSAccountB varchar(38)3)4AS5BEGIN6 DECLARE @Memberlist nvarchar(max)7 DECLARE @UID_UNSRootB AS varchar(38)8 DECLARE @XUser nvarchar(64)9 DECLARE @Xdate Datetime10 DECLARE @Sollzustand QBM_YParameterList11 DECLARE @QBM_BitPatternXOrigin_Direct int = dbo.QBM_FGIBitPatternXOrigin('|Direct|',12 0)13 DECLARE @QBM_BitPatternXOrigin_Direct_inv int = dbo.QBM_FGIBitPatternXOrigin('|Direct|',14 1)15 DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',16 1)17 SET XACT_ABORT OFF18 BEGIN TRY19 SELECT @Xdate = getUTCDate()20 SELECT @XUser = 'sa'21 SELECT22 @Memberlist = isnull(MemberOf,23 ''),24 @UID_UNSRootB = UID_UNSRootB25 FROM UNSAccountB26 WHERE27 UID_UNSAccountB = @UID_UNSAccountB28 INSERT INTO @Sollzustand(ContentShort)29 SELECT30 DISTINCT ParameterValue31 FROM dbo.QBM_FCVStringToList(@Memberlist,32 nchar(7),33 0,34 0)35 UPDATE @Sollzustand36 SET Parameter1 = g.UID_UNSGroupB,37 Parameter2 = dbo.QBM_FCVElementToObjectKey2('UNSAccountBInUNSGroupB',38 'UID_UNSAccountB',39 @UID_UNSAccountB,40 'UID_UNSGroupB',41 g.UID_UNSGroupB)42 FROM @Sollzustand s,43 UNSGroupB g44 WHERE45 s.ContentShort = g.cn AND g.UID_UNSRootB = @UID_UNSRootB46 DELETE @Sollzustand47 WHERE48 Parameter1 IS NULL49 INSERT INTO UNSAccountBInUNSGroupB(UID_UNSAccountB,50 UID_UNSGroupB,51 XObjectKey,52 XDateInserted,53 XDateUpdated,54 XUserInserted,55 XUserUpdated,56 XOrigin)57 SELECT58 @UID_UNSAccountB,59 s.Parameter1,60 s.Parameter2,61 @Xdate,62 @Xdate,63 @XUser,64 @XUser,65 @QBM_BitPatternXOrigin_Direct66 FROM @Sollzustand s67 WHERE68 NOT EXISTS(69 SELECT TOP 1 170 FROM UNSAccountBInUNSGroupB uig71 WHERE72 uig.XObjectKey = s.Parameter2)73 UPDATE UNSAccountBInUNSGroupB74 SET XOrigin = XOrigin & @QBM_BitPatternXOrigin_Direct_inv,75 XDateUpdated = @Xdate,76 XUserUpdated = @XUser77 WHERE78 UID_UNSAccountB = @UID_UNSAccountB AND XOrigin & @QBM_BitPatternXOrigin_Direct > 079 END TRY80 BEGIN CATCH81 EXEC QBM_PSessionErrorAdd DEFAULT82 RAISERROR('',83 18,84 1)85 WITH NOWAIT86 END CATCH87 ende:88END
Open raw exported source
1 create procedure TSB_PMemberOfSplitToGroups (@UID_UNSAccountB varchar(38) )as begin declare @Memberlist nvarchar(max) declare @UID_UNSRootB 2as varchar(38) declare @XUser nvarchar(64) declare @Xdate Datetime declare @Sollzustand QBM_YParameterList declare @QBM_BitPatternXOrigin_Direct int3 = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0) declare @QBM_BitPatternXOrigin_Direct_inv int = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 1) declare @QBM_BitPatternXOrigin_Inherit_inv4 int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1) SET XACT_ABORT OFF BEGIN TRY select @Xdate = getUTCDate() select @XUser = 'sa' select @Memberlist 5= isnull(MemberOf,'') , @UID_UNSRootB = UID_UNSRootB from UNSAccountB where UID_UNSAccountB = @UID_UNSAccountB insert into @Sollzustand(ContentShort )6 select distinct ParameterValue from dbo.QBM_FCVStringToList(@Memberlist, nchar(7), 0, 0 ) update @Sollzustand set Parameter1 = g.UID_UNSGroupB , Parameter27 = dbo.QBM_FCVElementToObjectKey2 ('UNSAccountBInUNSGroupB', 'UID_UNSAccountB', @UID_UNSAccountB , 'UID_UNSGroupB', g.UID_UNSGroupB) from @Sollzustand8 s , UNSGroupB g where s.ContentShort = g.cn and g.UID_UNSRootB = @UID_UNSRootB delete @Sollzustand where Parameter1 is null insert into UNSAccountBInUNSGroupB9 (UID_UNSAccountB , UID_UNSGroupB , XObjectKey, XDateInserted, XDateUpdated, XUserInserted, XUserUpdated, XOrigin) select @UID_UNSAccountB, s.Parameter110 , s.Parameter2 , @Xdate, @Xdate, @XUser, @XUser, @QBM_BitPatternXOrigin_Direct from @Sollzustand s where Not exists (select top 1 1 from UNSAccountBInUNSGroupB11 uig where uig.XObjectKey = s.Parameter2 ) update UNSAccountBInUNSGroupB set XOrigin = XOrigin & @QBM_BitPatternXOrigin_Direct_inv , XDateUpdated 12= @Xdate , XUserUpdated = @XUser where UID_UNSAccountB = @UID_UNSAccountB and XOrigin & @QBM_BitPatternXOrigin_Direct > 0 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd13 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: end 14