AV综合亚洲欧美,菠萝蜜视频在线观看,天堂av性爱在线,婷婷五月开心色婷在线

首頁 服務(wù) 產(chǎn)品 文檔 關(guān)于

mssqlserver 刪除包含指定字符串的數(shù)據(jù)表或視圖

刪除表格

CREATE PROCEDURE dbo.PROC_DELTABLE?

AS?
DECLARE @TABLENAME AS NVARCHAR(128)?
DECLARE cur_del CURSOR FOR
select name from sysobjects where type='U' and name like '指定的字符串%'
OPEN cur_del?
FETCH NEXT FROM cur_del INTO @TABLENAME?
WHILE(@@FETCH_STATUS=0)?
BEGIN?
PRINT 'drop table '+@TABLENAME?
EXEC('drop table '+@TABLENAME)?
FETCH NEXT FROM cur_del INTO @TABLENAME?
END?
CLOSE cur_del?
DEALLOCATE cur_del?
GO

EXEC PROC_DELTABLE



刪除視圖

CREATE PROCEDURE dbo.PROC_VIEW
AS?
DECLARE @VIEWNAME AS NVARCHAR(128)?
DECLARE cur_del CURSOR FOR
select name from sysobjects where xtype='v' and name like '指定的字符串%'
OPEN cur_del?
FETCH NEXT FROM cur_del INTO @VIEWNAME?
WHILE(@@FETCH_STATUS=0)?
BEGIN?
PRINT 'drop view '+@VIEWNAME??
EXEC('drop view '+@VIEWNAME?)?
FETCH NEXT FROM cur_del INTO @VIEWNAME?
END?
CLOSE cur_del?
DEALLOCATE cur_del?
GO

EXEC PROC_VIEW