generating a table script for a SQLCompare.Engine

Brian DonahueBrian Donahue Posts: 6,590 New member
edited November 23, 2004 12:46PM in SQL Toolkit Previous Versions

The ScriptObject method of the Work object is probably what you're after. This will create a script of any object that you ask it to. Here is some example code:
Database db=new Database();

db.Register(new ConnectionProperties(".", "WidgetStaging"), Options.Default);

Work work=new Work();

//get the script for an object
Regions regions=work.ScriptObject(db.Tables[0], Options.Default);

Console.WriteLine("SQL script:\n{0}", regions.ToString());


[Visual Basic]

Dim db As New Database()

db.Register(New ConnectionProperties(".", "WidgetStaging"), Options.Default)

Dim work As New Work()

'get the script for an object

Dim regions As Regions = work.ScriptObject(db.Tables(0), Options.Default)

Console.WriteLine("SQL script:")
Console.WriteLine("{0}", regions.ToString())

This discussion has been closed.