Red Gate forums :: View topic - HowTo disable transactions in migration script?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

HowTo disable transactions in migration script?

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
pil0t



Joined: 27 Apr 2009
Posts: 8

PostPosted: Mon Apr 27, 2009 5:49 pm    Post subject: HowTo disable transactions in migration script? Reply with quote

How to disable writing of this lines using ExecutionBlock.GetString():

IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION

IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END

In SqlCompare I check "Do not use transactions in synchronisation scripts"

in SDK there no such Options.
Tried NoSQLPlumbing, but it does't work.

This is a part of another problem.

I need SQL script for changing schema and data in single transaction.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6588

PostPosted: Mon Apr 27, 2009 6:53 pm    Post subject: Reply with quote

Hi,

NoSQLPlumbing is in fact the option you are looking for. I'd say that the most likely culprit is that you had not applied your options in all the right places, for instance:

  • In the Register method: stagingDB.Register(sourceConnectionProperties, Options.Default | Options.NoSQLPlumbing);
  • In the CompareWith method: Differences stagingVsProduction = stagingDB.CompareWith(productionDB, Options.Default | Options.NoSQLPlumbing);
  • And most importantly in the BuildFromDifferences method: work.BuildFromDifferences(stagingVsProduction, Options.Default | Options.NoSQLPlumbing, true);

If you want to run this in one big transaction using ADO .NET's SqlTransaction class, remember to strip all of the GO commands (batch separators) out as well. Here is an example of how to strip out the batch separators and run the synchronization through ADO .NET.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group