Sunday, March 25, 2012

Cannot drop stored proc

I use sp_rename to rename several stored procedures.
sp_rename 'MyDB.dbo.spRPTKCTicketCount', ''MyDB.dbo.spRPTKCTicketCount_obsol
ete'
The message was:The object was renamed to 'MyDB.dbo.spRPTKCTicketCount'_obso
lete'.
Caution: Changing any part of an object name could break scripts and stored
procedures.
But now, I cannot drop the stored procedure because it was stored in sysobje
cts as 'MyDB.dbo.spRPTKCTicketCount'_obsolete'
So when I use drop 'MyDB.dbo.spRPTKCTicketCount'_obsolete' it return an erro
r saying that
"Server: Msg 166, Level 15, State 1, Line 1
'DROP PROCEDURE' does not allow specifying the database name as a prefix to
the object name"
and if I take the Database name out of it, it says that it cannot find the i
t in the system catalogs.
Please help...Hi Jorge
Can you try putting the name in square brackets?
DROP PROCEDURE [MyDB.dbo.spRPTKCTicketCount_obsolete]
If that doesn't work, see if you can change the name again, to something
simpler.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Jorge" <anonymous@.discussions.microsoft.com> wrote in message
news:6A32D11A-2EFE-48BA-B61F-F1004EB1F446@.microsoft.com...
> I use sp_rename to rename several stored procedures.
> sp_rename 'MyDB.dbo.spRPTKCTicketCount',
''MyDB.dbo. spRPTKCTicketCount_obsolete'ed">
> The message was:The object was renamed to
'MyDB.dbo.spRPTKCTicketCount'_obsolete'.
> Caution: Changing any part of an object name could break scripts and
stored procedures.
> But now, I cannot drop the stored procedure because it was stored in
sysobjects as 'MyDB.dbo. spRPTKCTicketCount'_obsolete'red">
> So when I use drop 'MyDB.dbo.spRPTKCTicketCount'_obsolete' it return an
error saying that
> "Server: Msg 166, Level 15, State 1, Line 1
> 'DROP PROCEDURE' does not allow specifying the database name as a prefix
to the object name"
> and if I take the Database name out of it, it says that it cannot find the
it in the system catalogs.
> Please help...
>|||Thank you...the brackets seem to work.
Actually, I'm impressed and surprised. I never thought that the author of Sq
l Server book would respond to me. It's an honor.
Jorge Chirinos
jorge_chirinos@.hotmail.com

No comments:

Post a Comment