Modify:
Copy Code code as follows:
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 + ' has been deleted ')
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 + ' has been modified ')
FETCH NEXT from Proccur into @procname
End
Close Proccur
Deallocate proccur
Delete:
Copy Code code as follows:
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 + ' has been deleted ')
FETCH NEXT from Proccur into @procname
End
Close Proccur
Deallocate proccur