Wrong sproc name generated

JayDialJayDial Posts: 3
edited January 12, 2007 5:49PM in SQL Compare Previous Versions
Hello,

Ive done a little searching for this issue, but i havent found anything. Im sorry if this is a duplicate.

I am synching two sql2k dbs on the same server, and some of the sprocs name are coming up incorrectly. The name in the object browser is correct, and the name in the permissions section is correct, but the CREATE PROC statement is incorrect. It looks like it is pulling a previous name of the sproc.

Example Below.

This is the error thrown :

The following error message was returned from the SQL Server:

[208] Invalid object name 'dbo.srch_PO_SEARCH_CAN4HR'.

The following SQL command caused the error:

GRANT EXECUTE ON [dbo].[srch_PO_SEARCH_CAN4HR] TO [datacat]

Here is the script that is generated :

-- Stored Procedure

CREATE PROC [dbo].[usp_PO_SEARCH_CAN4HR]
(
@ASN	varchar(25) = NULL,		--=NULL=--
@OLN	varchar(25) = NULL
)

AS

DECLARE	@RetCode		int,
		@Msg			varchar(255),
		@SP				sysname


SET		@RetCode = 0
SET		@Msg = ''

BEGIN
	SELECT	DISTINCT PORDERNBR,
			PURCHTYPE,
			--SUPPLPROGID,
			SUPPLPROGRAM_TEXT AS PROGRAM,
			--PURCHSTATUS,
			PURCHSTATUS_TEXT AS STATUS,
			CREATIONDATE,
			CREATEDBY

	FROM vwPURCHORDERS_Expanded
	WHERE 
		( @ASN IS NULL OR
			vwPURCHORDERS_Expanded.ASN = @ASN )
		AND (@OLN IS NULL OR
			vwPURCHORDERS_Expanded.OLN = @OLN )
		AND SUPPLPROGRAM_TEXT = 'CAN 4HR'


	ORDER BY PORDERNBR ASC

	IF @@ERROR <> 0 
	BEGIN
			SET		@RetCode = @@ERROR
			SET		@Msg = '(-120) Error Retrieving from vwPURCHORDERS_Expanded'
			GOTO	EndError
	END
END

GOTO EndProc

EndError:
SET		@Retcode = ISNULL( @Retcode, -99 )
SET		@SP = 'usp_PO_Search_US4HR'
RAISERROR ( 50010, 16, 1, @SP, @Msg, @RetCode )

EndProc:
RETURN @RetCode

GO
-- Permissions

GRANT EXECUTE ON  [dbo].[srch_PO_SEARCH_CAN4HR] TO [datacat]


This is version 5.3

Thanks for any help,

JayDial

Comments

Sign In or Register to comment.