Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kernelvn
Starting Member
4 Posts |
Posted - 2007-05-10 : 05:06:38
|
I use T-SQL to flush database server (principal role) but not find out the way to hanlde failover occur for my demoCan you help???Here is my code (without success) wishing any suggetiondeclare @ConnectA as smallintdeclare @id as bigint:setvar Database2Mirror Mirroring:setvar partnername partneraset @ConnectA = 1set @id = 1while (1 > 0) begin set @id = @id + 1 begin try :connect $(partnername) use Mirroring; print 'Insert in to servername: '; insert into dbo.UserInfor (IncreaseNumber) values (@id); end try begin catch w if (@ConnectA = 1) :setvar partnername partnerb set @connectA = 2 else :setvar partnername partnera set @connectA = 1 :connect $(partnername) continue end catch end |
|
|
|
|