Кирилл Чурилин (cowboy_chur) wrote,
Кирилл Чурилин
cowboy_chur

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using System.Data.SqlClient;
using Microsoft.SqlServer.Management.Common;

namespace ConsoleApplication1
{
class Program
{
const string dbConnection = "Server=LOCALHOST\\SQLEXPRESS;Database=MOSAIC;Trusted_Connection=Yes";

static void Main(string[] args)
{
SqlConnection connection = new SqlConnection(dbConnection);
Server server = new Server(new ServerConnection(connection));
Database database = server.Databases[connection.Database];

Table table = new Table(database, "Table1");

Column column1 = new Column(table, "Column1", DataType.VarBinaryMax);
Column column2 = new Column(table, "Column2", DataType.NVarCharMax);
Column column3 = new Column(table, "Column3", DataType.VarCharMax);

table.Columns.Add(column1);
table.Columns.Add(column2);
table.Columns.Add(column3);

table.Create();
}
}
}
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 11 comments