还有,要用sql 代码在表内删除某字段或增加字段,如何写? ----------------------------------------------------------------------------------- ALTER TABLE 通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。具体语法,请参见SQL联机帮助!
还有,要用sql 代码在表内删除某字段或增加字段,如何写? alter table tablename add column_name type alter table tablename drop column column_name
---获取全部表名,字段名和所有相关信息 SELECT b.name '表名',a.colorder '序号',a.name '字段名',c.name '类型',a.length '长度',a.isnullable '空值', a.cdefault '默认值' FROM syscolumns a,sysobjects b,systypes c WHERE a.id=b.id and b.xtype='u' and a.xtype=c.xtype order by b.name,a.colorder------取表名SELECT distinct(b.name) '表名' FROM syscolumns a,sysobjects b,systypes c WHERE a.id=b.id and b.xtype='u' and a.xtype=c.xtype order by b.name
每个表和视图中的每列在表中占一行,存储过程中的每个参数在表中也占一行。该表位于每个数据库中。
-----------------------------------------------------------------------------------
ALTER TABLE
通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。具体语法,请参见SQL联机帮助!
alter table tablename add column_name type
alter table tablename drop column column_name
SELECT b.name '表名',a.colorder '序号',a.name '字段名',c.name '类型',a.length '长度',a.isnullable '空值',
a.cdefault '默认值' FROM syscolumns a,sysobjects b,systypes c WHERE a.id=b.id and b.xtype='u'
and a.xtype=c.xtype order by b.name,a.colorder------取表名SELECT distinct(b.name) '表名' FROM syscolumns a,sysobjects b,systypes c WHERE a.id=b.id and b.xtype='u'
and a.xtype=c.xtype order by b.name