--批量删除数据库中的表use 数据库名declare @tname varchar(8000)set @tname=''select @tname=@tname + Name + ',' from sysobjects where xtype='U'select @tname='drop table ' + left(@tname,len(@tname)-1)exec(@tname) --获取table表中列的个数select count(*) from sysobjects a join syscolumns b on a.id=b.idwhere a.name='表名'
select *into 表名form [数据库A].DBO.表名
--根据列号找列名
select namefrom syscolumnswhere id=object_id('HST10') and colid=3
--获取用户创建的表 select name from sysobjects where xtype='U'