Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RAISERROR('10 Regenerate Replication Triggers',0,1) WITH NOWAIT
- GO
- BEGIN -- 10 Regenerate Replication Triggers
- /*-----------------------------------------------
- 10
- Regenerate Replication Triggers for _App Databases
- Code similar to the following should be executed against
- all _App databases. The referenced event needs to be
- created in your LIVE _App databases so that it will be
- available in the TEST version after restore
- -----------------------------------------------*/
- IF @@SERVERNAME = 'SQLSERVERNAME'
- BEGIN
- DECLARE
- @EventParmId UniqueIdentifier
- ,@Severity INT
- ,@SessionID UniqueIdentifier
- ,@result NVARCHAR(MAX)
- ,@Infobar NVARCHAR(2800)
- ,@i INTEGER
- ,@DBName NVARCHAR(255)
- BEGIN --MAIN
- USE [XX_MAIN_APP]
- SELECT @SessionID = NEWID()
- SET @DBName = DB_NAME()
- EXEC dbo.InitSessionSp @SessionID, 'sa'
- SELECT @EventParmId = NEWID()
- EXEC @Severity = dbo.InsertEventInputParameterSp
- @EventParmId = @EventParmId
- ,@Name = N'TableNameVar'
- ,@Value = ''
- ,@IsOutput = 0
- EXEC @Severity = dbo.InsertEventInputParameterSp
- @EventParmId = @EventParmId
- ,@Name = N'ServerNameVar'
- ,@Value = @@SERVERNAME
- ,@IsOutput = 0
- EXEC @Severity = dbo.InsertEventInputParameterSp
- @EventParmId = @EventParmId
- ,@Name = N'DatabaseNameVar'
- ,@Value = @DBName
- ,@IsOutput = 0
- EXEC @Severity = dbo.FireEventSp
- @eventName = N'ILC_RegenerateReplicationTriggers'
- ,@initiator = NULL
- ,@configName = 'BD_MAIN'
- ,@sessionID = @SessionID
- ,@eventTrxId = NULL
- ,@eventParmID = @EventParmId
- ,@transactional = 0
- ,@generatingEventActionStateRowPointer = NULL
- ,@anyHandlersFailed = 0
- ,@result = @result OUTPUT
- ,@Infobar = @Infobar OUTPUT
- END
- END
- END
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement