/*
Delete Del Table
*/
declare @tblName varchar(300)
declare curTblName
cursor fast_forward
for
select TABLE_NAME
from srvDB.INFORMATION_SCHEMA.tables where TABLE_NAME like '%삭제%'
open curTblName
fetch next from curTblName
into @tblName
while @@FETCH_STATUS
= 0
begin
exec ('drop table ' + @tblName)
fetch next from curTblName
into
@tblName
end
close curTblName
deallocate curTblName
/*
Delete SP
*/
declare @prcName
varchar(300)
declare curPrcName
cursor fast_forward
for
select ROUTINE_NAME
from
srvDB.INFORMATION_SCHEMA.ROUTINES
where ROUTINE_NAME like '%삭제%'
open curPrcName
fetch next from curPrcName
into @prcName
while @@FETCH_STATUS
= 0
begin
exec ('drop proc ' + @prcName)
fetch next from curPrcName
into
@prcName
end
close curPrcName
deallocate curPrcName
'Brain Trainning > DataBase' 카테고리의 다른 글
Understanding How Restore and Recovery of Backups Work in SQL Server 2005 (0) | 2010.08.19 |
---|---|
sp_readerrorlog (xp_readerrorlog) (0) | 2010.08.17 |
버전 호환성 Upgrade 작업 후 해야할 작업 (0) | 2010.08.12 |
SP_Helpindex2 (0) | 2010.08.11 |
DB 파일 사용상태 쿼리 (0) | 2010.08.06 |