首页 > 数据库技术 > 详细

sql server 批量删除数据表

时间:2015-03-02 12:52:20      阅读:313      评论:0      收藏:0      [点我收藏+]


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
alter PROCEDURE [dbo].[CANCELTABLE]

AS
BEGIN
DECLARE @cul int
declare @tablename varchar(50)
declare @dropSql nvarchar(100)
select @cul=COUNT(name) from sysobjects where name like ‘stt%‘
while @cul>0
begin

select @tablename=tb1.name from (select top 1 name from sysobjects where name like ‘stt%‘) as tb1
set @dropSql=‘drop table‘+‘ ‘+@tablename;
EXECUTE sp_executesql @dropSql
select @cul=COUNT(name) from sysobjects where name like ‘stt%‘
end

END
GO

sql server 批量删除数据表

原文:http://www.cnblogs.com/woshare/p/4308360.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!