generating a table script for a SQLCompare.Engine
Brian Donahue
Posts: 6,590 Bronze 1
Hi,
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:
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());
db.Dispose();
[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())
'dispose
db.Dispose()
This discussion has been closed.