dbo.POL_PQERPolicyMakeProc
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_FSQProcedureDef source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PSQLCreate source text reference
References
Referenced By
Complete Source
1CREATE PROCEDURE POL_PQERPolicyMakeProc(2 @uid_QERPolicy varchar(38),3 @Procname varchar(30)4)5AS6BEGIN7 DECLARE @whereClause nvarchar(max)8 DECLARE @Ident_QERPolicy nvarchar(64)9 DECLARE @TableName nvarchar(32)10 DECLARE @isToGrantEver BIT11 DECLARE @PreInsert nvarchar(max)12 DECLARE @PreDelete nvarchar(max)13 DECLARE @PostInsert nvarchar(max)14 DECLARE @PostDelete nvarchar(max)15 DECLARE @SQLcmdKomplett nvarchar(max)16 DECLARE @ErrorMessage nvarchar(4000)17 DECLARE @ErrorSeverity int18 DECLARE @ErrorState int19 DECLARE @DebugSwitch int = 020 DECLARE @DebugLevel char(1) = 'W'21 SET XACT_ABORT OFF22 BEGIN TRY23 SELECT24 @whereClause = whereclause,25 @Ident_QERPolicy = replace(isnull(p.Ident_QERPolicy, N ''),26 N '''',27 N ''''''),28 @TableName = t.TableName29 FROM QERPolicy p30 JOIN DialogTable t31 ON t.UID_DialogTable = p.UID_DialogTable32 WHERE33 p.UID_QERPolicy = @uid_QERPolicy34 IF rtrim(isnull(@whereClause, N '')) = N ''35 BEGIN36 SELECT @whereClause = N '1=1'37 END38 SELECT39 @PreInsert = '40truncate table #QBMDeltaInsert 4142insert into #QBMDeltaInsert (Element, AssignedElement )43 select ''' + rtrim(@UID_QERPolicy44 ) + N ''', XObjectKey45 from ' + @TableName + '46 where Not exists (select top 1 1 from QERPolicyHasObject pho47 where pho.uid_QERPolicy = '''48 + rtrim(@UID_QERPolicy) + N '''49 and pho.Objectkey = ' + @TableName + '.XObjectKey50 )51 and (52-- StartUserCondition 53'54 SELECT @PostInsert = '55-- EndUserCondition 56 )57'58 SELECT59 @PreDelete = '60truncate table #QBMDeltaDelete6162insert into #QBMDeltaDelete (Element, AssignedElement )63 select ''' + rtrim(@UID_QERPolicy64 ) + ''', pho.ObjectKey65 from QERPolicyHasObject pho 66 left outer join ( select XObjectKey 67 from ' + @TableName + ' 68 where (69 -- StartUserCondition 70 '71 SELECT72 @PostDelete = '73 -- EndUserCondition 74 )75 ) as xxp on pho.ObjectKey = xxp.XObjectKey76 where pho.uid_QERPolicy = '''77 + rtrim(@UID_QERPolicy) + N '''78 and xxp.XObjectKey is null79'80 SELECT81 @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname,82 '',83 @Preinsert + @whereclause + @Postinsert + @Predelete + @whereclause + @PostDelete,84 'QERPolicy : ' + @Ident_QERPolicy + '(' + @uid_QERPolicy + ')')85 IF @DebugSwitch > 086 BEGIN87 print @SQLcmdKomplett88 END89 EXEC QBM_PSQLCreate @Procname,90 'P',91 @SQLcmdKomplett,92 @UnComment = 093 END TRY94 BEGIN CATCH95 EXEC QBM_PSessionErrorAdd DEFAULT96 RAISERROR('',97 18,98 1)99 WITH NOWAIT100 END CATCH101 RETURN102END
Open raw exported source
1 create procedure POL_PQERPolicyMakeProc (@uid_QERPolicy varchar(38) , @Procname varchar(30) ) as begin declare @whereClause nvarchar(max2) declare @Ident_QERPolicy nvarchar(64) declare @TableName nvarchar(32) declare @isToGrantEver bit declare @PreInsert nvarchar(max) declare @PreDelete3 nvarchar(max) declare @PostInsert nvarchar(max) declare @PostDelete nvarchar(max) declare @SQLcmdKomplett nvarchar(max) declare @ErrorMessage nvarchar4(4000) declare @ErrorSeverity int declare @ErrorState int declare @DebugSwitch int = 0 declare @DebugLevel char(1) = 'W' SET XACT_ABORT OFF BEGIN TRY select5 @whereClause = whereclause , @Ident_QERPolicy = replace(isnull(p.Ident_QERPolicy, N''), N'''', N'''''') , @TableName = t.TableName from QERPolicy p join6 DialogTable t on t.UID_DialogTable = p.UID_DialogTable where p.UID_QERPolicy = @uid_QERPolicy if rtrim(isnull(@whereClause, N'') ) = N'' begin select 7@whereClause = N'1=1' end select @PreInsert = '8truncate table #QBMDeltaInsert 910insert into #QBMDeltaInsert (Element, AssignedElement )11 select '''12 + rtrim(@UID_QERPolicy) + N''', XObjectKey13 from ' + @TableName + '14 where Not exists (select top 1 1 from QERPolicyHasObject pho15 where pho.uid_QERPolicy = '''16 + rtrim(@UID_QERPolicy) + N'''17 and pho.Objectkey = ' + @TableName + '.XObjectKey18 )19 and (20-- StartUserCondition 21'22 select @PostInsert = '23-- EndUserCondition 24 )25' select @PreDelete = '26truncate table #QBMDeltaDelete2728insert into #QBMDeltaDelete (Element, AssignedElement )29 select '''30 + rtrim(@UID_QERPolicy) + ''', pho.ObjectKey31 from QERPolicyHasObject pho 32 left outer join ( select XObjectKey 33 from ' + @TableName + ' 34 where (35 -- StartUserCondition 36 '37 select @PostDelete = '38 -- EndUserCondition 39 )40 ) as xxp on pho.ObjectKey = xxp.XObjectKey41 where pho.uid_QERPolicy = ''' 42+ rtrim(@UID_QERPolicy) + N'''43 and xxp.XObjectKey is null44' select @SQLcmdKomplett = dbo.QBM_FSQProcedureDef(@Procname, '', @Preinsert + @whereclause45 + @Postinsert + @Predelete + @whereclause + @PostDelete , 'QERPolicy : ' + @Ident_QERPolicy + '(' + @uid_QERPolicy + ')' ) if @DebugSwitch > 0 begin print46 @SQLcmdKomplett end exec QBM_PSQLCreate @Procname, 'P', @SQLcmdKomplett, @UnComment = 0 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR47 ('', 18, 1) WITH NOWAIT END CATCH return end 48