111,119
社区成员
发帖
与我相关
我的任务
分享 string sql1 = "select name from sysobjects where xtype='u' order by name";//已存在的表SQL
string sql2 = "select a.name tablename,b.name cname,c.name ctype,b.length clen from sysobjects a,syscolumns b,systypes c where a.id=b.id and a.xtype='u' and b.xtype=c.xtype and a.name='{0}' order by b.name ";//表结构SQL
string sql3 = "ALTER TABLE [{0}] add [{1}] {2}";//增加列
string sql4 = "ALTER TABLE [{0}] alter column [{1}] {2}";//修改列
string sql5 = "ALTER TABLE [{0}] DROP COLUMN [{1}]";//删除列
string sql6 = "sp_rename '{0}.{1}','{2}','column'";//重命名列名
string delsql = "drop table [{0}]";//删除表