Options

Suppress Comments in provider.GetMigrationSQL method

Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
edited April 28, 2004 9:30AM in SQL Toolkit Previous Versions
Hi Jimmy,

There isn't an 'automatic' way of doing that, no. What you could do is
to break the ExecutionBlock into individual batches and 'filter' out the
batches that are actually comments:

RedGate.SQL.Shared.ExecutionBlock obExeBlock =
obSqlProvider1.GetMigrationSQL(obComparisonSession, false);

for (int i=0; i<obExeBlock.BatchCount; i++)

{

Batch b;

b=obExeBlock.GetBatch(i);

if (b.Contents.IndexOf("/*",0,2)==0 || b.Contents.IndexOf("--",0,2)==0)
Console.WriteLine("This is a comment:
"+b.Contents+"
");

else Console.WriteLine("This is not a comment:
"+b.Contents+"
");

}

Console.ReadLine();

Once you are able to figure out which blocks are comments, you can write
only the non-comment blocks to your output script.

Regards,

Brian Donahue

Red Gate Technical Support




"Jimmy Vecera" <jimmy.vecera@ntn.com> wrote in message
news:y1LSgUHLEHA.1616@server53...
> Is there any way to suppress comments in the provider.GetMigrationSQL
> method?
>
> Thanks,
>
> Jimmy Vecera
>
>
This discussion has been closed.