xSQL.Schema.SqlServer Namespace > SqlDatabase Class > CreateFromSnapshot Method : CreateFromSnapshot(String,EventHandler<SnapshotOperationEventArgs>) Method |
'Declaration Public Overloads Shared Function CreateFromSnapshot( _ ByVal fileName As System.String, _ Optional ByVal snapshotOperationProgress As System.EventHandler(Of SnapshotOperationEventArgs) _ ) As SqlDatabase
public static SqlDatabase CreateFromSnapshot( System.string fileName, System.EventHandler<SnapshotOperationEventArgs> snapshotOperationProgress )
public: static SqlDatabase* CreateFromSnapshot( System.string* fileName, System.EventHandler<SnapshotOperationEventArgs*>* snapshotOperationProgress )
using xSQL.Schema.Core; using xSQL.Schema.SqlServer; using xSQL.SchemaCompare.SqlServer; namespace xSQL.Sdk.SchemaCompare.Samples { class Test { public static void CreateDatabaseFromSnapshot() { SqlDatabase database; SqlTable table; ScriptingOptions options; try { //--create the database object from the snapshot file database = SqlDatabase.CreateFromSnapshot(@"C:\AdventureWorks.snpx"); //--locate and script the Employee table table = database.SqlTables["HumanResources", "Employee"]; if (table != null) { options = new ScriptingOptions(); options.CreateScript = true; options.DropScript = false; options.AlterScript = false; Console.Write(table.GetScript(options)); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2