22,207
社区成员
发帖
与我相关
我的任务
分享
IF EXISTS(select ObjectProperty(Object_ID( 'students'),'IsUserTable')) ALTER TABLE students DROP COLUMN status
IF (EXISTS(select ObjectProperty(Object_ID( 'students'),'IsUserTable'))
and (EXISTS(select case col_length('students','[status]') when null then 0 else 1 end)))
ALTER TABLE students DROP COLUMN [status]
IF EXISTS(select * from sys.tables where name ='students') and
exists(select * from sys.columns where object_id = object_id('students') and name = 'status')
ALTER TABLE students DROP COLUMN status
SELECT * FROM SYS.all_columns
where OBJECT_ID =(SELECT object_id FROM SYS.all_objects WHERE name='a000')
and name='id'