sqlserver 批量刪除存儲(chǔ)過程和批量修改存儲(chǔ)過程的語句
更新時(shí)間:2011年07月11日 23:32:20 作者:
sqlserver 批量刪除存儲(chǔ)過程和批量修改存儲(chǔ)過程的語句,需要的朋友可以參考下。
修改:
declare proccur cursor
for
select [name] from sysobjects where name like 'Foods_%'
declare @procname varchar(100)
declare @temp varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
set @temp='kcb_'+@procname
EXEC SP_RENAME @procname,@temp
print(@procname + '已被刪除')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
declare proccur cursor
for
select [name] from sysobjects where name like 'kcb%'
declare @procname varchar(100)
declare @temp varchar(100)
declare @temp2 varchar(100)
declare @temp3 varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
set @temp3= LEN(@procname)
set @temp='kcb_'
set @temp2=RIGHT(@procname,@temp3-3)
set @temp+=@temp2
EXEC SP_RENAME @procname,@temp
print(@procname + '已被修改')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
刪除:
declare proccur cursor
for
select [name] from sysobjects where name like 'Users_%'
declare @procname varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
exec('drop proc ' + @procname)
print(@procname + '已被刪除')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
復(fù)制代碼 代碼如下:
declare proccur cursor
for
select [name] from sysobjects where name like 'Foods_%'
declare @procname varchar(100)
declare @temp varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
set @temp='kcb_'+@procname
EXEC SP_RENAME @procname,@temp
print(@procname + '已被刪除')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
declare proccur cursor
for
select [name] from sysobjects where name like 'kcb%'
declare @procname varchar(100)
declare @temp varchar(100)
declare @temp2 varchar(100)
declare @temp3 varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
set @temp3= LEN(@procname)
set @temp='kcb_'
set @temp2=RIGHT(@procname,@temp3-3)
set @temp+=@temp2
EXEC SP_RENAME @procname,@temp
print(@procname + '已被修改')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
刪除:
復(fù)制代碼 代碼如下:
declare proccur cursor
for
select [name] from sysobjects where name like 'Users_%'
declare @procname varchar(100)
open proccur
fetch next from proccur into @procname
while(@@FETCH_STATUS = 0)
begin
exec('drop proc ' + @procname)
print(@procname + '已被刪除')
fetch next from proccur into @procname
end
close proccur
deallocate proccur
相關(guān)文章
SQL?Server?2019完整安裝教程(最新最詳細(xì)!)
SQL Server是一款Microsoft公司推出的關(guān)系型數(shù)據(jù)庫管理系統(tǒng),下面這篇文章主要給大家介紹了關(guān)于SQL?Server?2019完整安裝教程的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),本文介紹的是最新最詳細(xì),需要的朋友可以參考下2023-02-02MySQL 數(shù)據(jù)庫 source 命令詳解及實(shí)例
這篇文章主要介紹了MySQL 數(shù)據(jù)庫 source 命令詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-06-06SQL?Server主鍵與外鍵設(shè)置以及相關(guān)理解
在數(shù)據(jù)庫的學(xué)習(xí)中對(duì)于一個(gè)表的主鍵和外鍵的認(rèn)識(shí)是非常重要的,下面這篇文章主要給大家介紹了關(guān)于SQL?Server主鍵與外鍵設(shè)置以及相關(guān)理解的相關(guān)資料,需要的朋友可以參考下2022-10-10SQL Server 2005/2008 用戶數(shù)據(jù)庫文件默認(rèn)路徑和默認(rèn)備份路徑修改方法
本環(huán)境是SQL Server 2005 Standard Version 64-bit 和 SQL Server 2008 Standard Version 64-bit 雙實(shí)例同時(shí)安裝在一個(gè)2010-04-04
Windows Server 2008 Standard Version 64-bit OS上當(dāng)恢復(fù)sqlserver bak文件時(shí),原始的用戶無法刪除的解決方法
當(dāng)你從現(xiàn)有的bak文件,恢復(fù)數(shù)據(jù)庫時(shí),如果數(shù)據(jù)庫本身帶有一個(gè)用戶:比如用戶叫:DemoUser.2010-06-06