select * From master.dbo.sysdatabases where name='数据库名'
select * from sysobjects where id = object_id('表名') //绝对不能有 master.dbo
select * from syscolumns where name='列名' and id=object_id('表名') //绝对不能有 master.dbo
1.增加列:
alter table tableName add columnName varchar(30)
2.修改列类型:
alter table tableName alter column columnName varchar(4000)
3.修改列的名称:
EXEC sp_rename 'tableName.column1' , 'column2' (把表名为tableName的column1列名修改为column2)
4.删除列:
alter table tableName drop column columnName