How to inject additional SQL Code into script

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

How to inject additional SQL Code into script

Postby mylesp » Wed Apr 24, 2013 1:06 am

As part of the differences/upgrade script produced, at the end and within the same transaction we want to be able to call stored procedures and update data tables (e.g. update the internal records that contain our database schema version).

Of course we want this to happen as part of the same transaction.

Is this possible?

We currently use the SQL Compare tool and then modify the script to perform these actions, but of course this cannot be done if we automate this process.

Or is there some way to wrap the current code up so that it uses an external transaction, and we can then perform the actions using normal ADO.NET functionality.

Thanks,
Myles.
mylesp
 
Posts: 2
Joined: Thu Dec 22, 2005 9:39 pm
Location: AMS Auckland New Zealand

Postby Brian Donahue » Thu Apr 25, 2013 10:16 am

Hello Myles, SDK doesn't specifically support slipstreaming SQL into the code written by the ExecutionBlock. What I do is pull apart the individual blocks and write them out in a loop -- then I can put my own custom SQL wherever I need to. Please see code sample here:

http://www.red-gate.com/supportcenter/c ... 0809000297
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests