首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

扫除表,存储过程

2012-07-29 
清除表,存储过程?清除表--declare @tname varchar(8000)--set @tname--select @tname@tname + Name +

清除表,存储过程

?

清除表

--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).

?

?

--清除存储过程

--declare @procName varchar(500)

-- ? ? declare cur cursor

-- ? ? ? ? ? for select [name] from sysobjects where type = 'p'

-- ? ? open cur

-- ? ? fetch next from cur into @procName

-- ? ? ?while @@fetch_status = 0

-- ? ? begin

-- ? ? ? ? ? ?if @procName <> 'DeleteAllProcedures'

-- ? ? ? ? ? ? ? ? exec('drop procedure ' + @procName)

-- ? ? ? ? ? ? ? ? fetch next from cur into @procName

-- ? ? end

-- ? ? close cur

-- ? ? deallocate cur

热点排行