注册 登录
编程论坛 SQL Server论坛

表格插入列

kcomshen 发布于 2010-08-17 23:00, 658 次点击
我想在 建好的表格中 插入一列 用命令 怎么实现呀

4 回复
#2
SQLCenter2010-08-18 01:01
insert into table_name(colname1,colname2...) values(value1,value2...)

#3
cnfarer2010-08-18 05:48
alter table ...
#4
红色警戒2010-08-18 08:22
程序代码:
//在数据表中添加数据列
        string MySQL = "ALTER TABLE 商品清单 ADD [检验员] [varchar] ([color=#800000; font-weight: bold]50[/color]) NULL;";
        SqlConnection MyConnection = new SqlConnection("Data Source = .;Database = MyDatabase;Integrated Security=SSPI");
        SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
        try
        {
            MyCommand.Connection.Open();
            MyCommand.ExecuteNonQuery();
            MessageBox.Show("成功在“商品清单”数据表中添加数据列", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        finally
        {
            MyConnection.Close();
        }
#5
luanyunfeng2010-08-20 10:43
alter table add 列名 属性 是否为空
1