Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 drop proc fail

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2008-06-15 : 11:22:18
I try to drop a proc:

IF OBJECT_ID('dbo.Notify_Insert') IS NOT NULL
DROP PROC dbo.Notify_Insert
GO

CREATE PROC dbo.Notify_Insert (
@NotifyID UNIQUEIDENTIFIER,
@NotifyTypeID SMALLINT,
@Reporter VARCHAR(200),
@NotifyTime DATETIME
)
AS
SET NOCOUNT ON

DECLARE @Error INT
DECLARE @ErrorMsg VARCHAR(200)
GO

and get Error:

Msg 2812, Level 16, State 62, Procedure Notify_DBError_Insert, Line 20
Could not find stored procedure 'dbo.Notify_Insert'.
The statement has been terminated.

any idea ?


Noam Graizer

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-15 : 12:15:11
Line 20 is not visible for us.
Please post FULL procedure code.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-15 : 12:15:34
Most likely it has to do with the "GO" keyword after the declarations.
That "GO" terminates the stored procedure body, and the SP is created with the code downto "GO".


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Johnho008
Starting Member

24 Posts

Posted - 2008-06-16 : 03:54:51
are you pointing to the correct database? try using
USE "{database name"
IF EXISTS ( SELECT name FROM Sysobjects WHERE name = 'Notify_Insert')
DROP PROCEDURE [Notify_Insert]
GO
CREATE PROC Notify_Insert
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-16 : 04:01:33
Is this code part of another SP?
quote:
Originally posted by noamg

...
IF OBJECT_ID('dbo.Notify_Insert') IS NOT NULL
DROP PROC dbo.Notify_Insert
GO

CREATE PROC dbo.Notify_Insert (
@NotifyID UNIQUEIDENTIFIER,
@NotifyTypeID SMALLINT,
@Reporter VARCHAR(200),
@NotifyTime DATETIME
)
AS
SET NOCOUNT ON

DECLARE @Error INT
DECLARE @ErrorMsg VARCHAR(200)
GO



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -