Esempio n. 1
0
    public static void CopyTableStructure(SqlTableReference sourceTable, SqlTableReference targetTable)
    {
        var sisTable          = InformationSchemaMetadataExplorer.GetInformationSchemaTableDefinition(sourceTable);
        var createTableScript = SISToSqlDmlCreateStatementGenerator.GenerateCreateTableScript(sisTable);

        targetTable.SqlConnectionProvider.Execute(createTableScript);
    }
    public void RetrieveHumanResourcesEmployeeTableAsJson()
    {
        var sqlTableReference = new SqlTableReference(SqlConnectionProviders.AdventureWorksDb, "HumanResources.Employee");
        var informationSchemaTableDefinition = InformationSchemaMetadataExplorer.GetInformationSchemaTableDefinition(sqlTableReference);
        var tableDefinitionAsJson            = JsonConvert.SerializeObject(informationSchemaTableDefinition);

        Console.WriteLine(tableDefinitionAsJson);
    }