dbo.QBM_PDatabasePrepareCheck1
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_FTPrimaryKeyInfo_BT source text reference
- references source dbo.QBM_FTPrimaryKeyInfo_BTV source text reference
- references source dbo.QBM_FTPrimaryKeyInfo_BTVP source text reference
- references source dbo.QBM_FCVElementToObjectKey1 source text reference
- references source dbo.QBM_FCVSchemaDatatypeToIntern source text reference
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_PColumnSchemaDataTypeCorr source text reference
- references source dbo.QBM_PDatabasePrepare source text reference
- references source dbo.QBM_PDialogTablePKNameCorrect source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PTableRevisionFill source text reference
References
- dbo.QBM_FTPrimaryKeyInfo_BT
- dbo.QBM_FTPrimaryKeyInfo_BTV
- dbo.QBM_FTPrimaryKeyInfo_BTVP
- dbo.QBM_FCVElementToObjectKey1
- dbo.QBM_FCVSchemaDatatypeToIntern
- dbo.QBM_FGISessionErrorRethrow
- dbo.QBM_PColumnSchemaDataTypeCorr
- dbo.QBM_PDatabasePrepare
- dbo.QBM_PDialogTablePKNameCorrect
- dbo.QBM_PSessionErrorAdd
- dbo.QBM_PTableRevisionFill
Referenced By
Complete Source
1CREATE PROCEDURE QBM_PDatabasePrepareCheck1(2 @WithoutPKCorrection BIT = 03)4AS5BEGIN6 DECLARE @XUser nvarchar(64) = object_name(@@procid)7 DECLARE @Xdate datetime = getutcdate()8 SET XACT_ABORT OFF9 BEGIN TRY10 SET nocount11 ON12 UPDATE DialogTable13 SET XObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogTable',14 'uid_Dialogtable',15 uid_Dialogtable),16 XDateUpdated = @Xdate,17 XUserUpdated = @XUser18 WHERE19 XObjectKey <> dbo.QBM_FCVElementToObjectKey1('DialogTable',20 'uid_Dialogtable',21 uid_Dialogtable)22 EXEC QBM_PColumnSchemaDataTypeCorr '%'23 UPDATE dialogcolumn24 SET Datatype = dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType,25 c.SchemaDatalen),26 XDateUpdated = @Xdate,27 XUserUpdated = @XUser28 FROM DialogColumn c29 JOIN DialogTable t30 WITH(readpast)31 ON c.UID_DialogTable = t.UID_DialogTable32 WHERE33 c.Datatype <> dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType,34 c.SchemaDatalen) AND t.TableType IN('B',35 'T',36 'M')37 UPDATE dialogcolumn38 SET Datatype = dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType,39 c.SchemaDatalen),40 XDateUpdated = @Xdate,41 XUserUpdated = @XUser42 FROM DialogColumn c43 JOIN DialogTable t44 WITH(readpast)45 ON c.UID_DialogTable = t.UID_DialogTable46 WHERE47 c.Datatype <> dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType,48 c.SchemaDatalen) AND t.TableType IN('R',49 'U',50 'P')51 UPDATE dialogcolumn52 SET datatype = x.datatype,53 XDateUpdated = @Xdate,54 XUserUpdated = @XUser55 FROM dialogcolumn,56 dialogcolumn x,57 DialogTable t58 WITH(readpast)59 WHERE60 dialogcolumn.UID_BaseColumn = x.uid_dialogcolumn AND dialogColumn.UID_DialogTable = t.UID_DialogTable AND t.tabletype = 'V' AND isnull(dialogcolumn.Datatype61 ,62 -1) <> x.Datatype63 UPDATE DialogColumn64 SET IsUID = 1,65 XDateUpdated = @Xdate,66 XUserUpdated = @XUser67 WHERE68 SchemaDataType = 'varchar' AND SchemaDataLen = 38 AND IsUID = 069 UPDATE DialogColumn70 SET IsUID = 0,71 XDateUpdated = @Xdate,72 XUserUpdated = @XUser73 WHERE74 (SchemaDataType <> 'varchar' OR SchemaDataLen <> 38) AND IsUID = 175 IF @WithoutPKCorrection = 176 BEGIN77 GOTO EndLabel78 END79 UPDATE DialogColumn80 SET IsPKMember = v.IsPKMember,81 XDateUpdated = @Xdate,82 XUserUpdated = @XUser83 FROM DialogColumn c84 JOIN dbo.QBM_FTPrimaryKeyInfo_BTVP() v85 ON c.UID_DialogColumn = v.UID_DialogColumn86 WHERE87 c.IsPKMember <> v.IsPKMember AND v.TableType NOT IN('U',88 'R')89 EXEC QBM_PDialogTablePKNameCorrect '%'90 UPDATE dialogcolumn91 SET XObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogColumn',92 'uid_dialogcolumn',93 uid_dialogcolumn),94 XDateUpdated = @Xdate,95 XUserUpdated = @XUser96 WHERE97 XObjectKey <> dbo.QBM_FCVElementToObjectKey1('DialogColumn',98 'uid_dialogcolumn',99 uid_dialogcolumn)100 EXEC QBM_PTableRevisionFill101 END TRY102 BEGIN CATCH103 EXEC QBM_PSessionErrorAdd DEFAULT104 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()105 RAISERROR(@Rethrow,106 18,107 1)108 WITH NOWAIT109 END CATCH110 endLabel:111 RETURN112END
Open raw exported source
1 create procedure QBM_PDatabasePrepareCheck1 (@WithoutPKCorrection bit = 0 ) as begin declare @XUser nvarchar(64) = object_name(@@procid) declare2 @Xdate datetime = getutcdate() SET XACT_ABORT OFF BEGIN TRY set nocount on update DialogTable set XObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogTable'3, 'uid_Dialogtable', uid_Dialogtable) , XDateUpdated = @Xdate , XUserUpdated = @XUser where XObjectKey <> dbo.QBM_FCVElementToObjectKey1('DialogTable'4, 'uid_Dialogtable', uid_Dialogtable) exec QBM_PColumnSchemaDataTypeCorr '%' update dialogcolumn set Datatype = dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType5, c.SchemaDatalen) , XDateUpdated = @Xdate , XUserUpdated = @XUser from DialogColumn c join DialogTable t with (readpast) on c.UID_DialogTable = t.UID_DialogTable6 where c.Datatype <> dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType, c.SchemaDatalen) and t.TableType in ('B', 'T', 'M') update dialogcolumn set Datatype7 = dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType, c.SchemaDatalen) , XDateUpdated = @Xdate , XUserUpdated = @XUser from DialogColumn c join DialogTable8 t with (readpast) on c.UID_DialogTable = t.UID_DialogTable where c.Datatype <> dbo.QBM_FCVSchemaDatatypeToIntern(c.SchemaDataType, c.SchemaDatalen) and9 t.TableType in ('R', 'U' , 'P' ) update dialogcolumn set datatype = x.datatype , XDateUpdated = @Xdate , XUserUpdated = @XUser from dialogcolumn , 10dialogcolumn x, DialogTable t with (readpast) where dialogcolumn.UID_BaseColumn = x.uid_dialogcolumn and dialogColumn.UID_DialogTable = t.UID_DialogTable11 and t.tabletype = 'V' and isnull(dialogcolumn.Datatype, -1) <> x.Datatype update DialogColumn set IsUID = 1 , XDateUpdated = @Xdate , XUserUpdated 12= @XUser where SchemaDataType = 'varchar' and SchemaDataLen = 38 and IsUID = 0 update DialogColumn set IsUID = 0 , XDateUpdated = @Xdate , XUserUpdated13 = @XUser where (SchemaDataType <> 'varchar' or SchemaDataLen <> 38 ) and IsUID = 1 if @WithoutPKCorrection = 1 begin goto EndLabel end update DialogColumn14 set IsPKMember = v.IsPKMember , XDateUpdated = @Xdate , XUserUpdated = @XUser from DialogColumn c join dbo.QBM_FTPrimaryKeyInfo_BTVP() v on c.UID_DialogColumn15 = v.UID_DialogColumn where c.IsPKMember <> v.IsPKMember and v.TableType not in ('U', 'R') exec QBM_PDialogTablePKNameCorrect '%' update dialogcolumn16 set XObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogColumn', 'uid_dialogcolumn', uid_dialogcolumn) , XDateUpdated = @Xdate , XUserUpdated = @XUser17 where XObjectKey <> dbo.QBM_FCVElementToObjectKey1('DialogColumn', 'uid_dialogcolumn', uid_dialogcolumn) exec QBM_PTableRevisionFill END TRY BEGIN CATCH18 exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH 19endLabel: return end 20