Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stored procedure parses correctly but will not execute. Invalid object name. Msg 208

I've scripted up a stored procedure as follows. It will parse without errors, but when I try to execute it, it will fail. The error message reads: Msg 208, Level 16, State 6, Procedure aspnet_updateUser, Line 23 Invalid object name 'dbo.aspnet_updateUser'.

Here is the stored procedure.

    USE [PMRS2]
GO
/****** Object:  StoredProcedure [dbo].[aspnet_updateUser]    Script Date: 05/25/2009 15:29:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[aspnet_updateUser]
    -- Add the parameters for the stored procedure here
    @UserName nvarchar(50),
    @Email nvarchar(50),
    @FName nvarchar(50),
    @LName nvarchar(50),
    @ActiveFlag bit,
    @GroupId int

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here

UPDATE dbo.aspnet_Users 
    SET UserName = @UserName, LoweredUserName = LOWER(@UserName), Email = @Email, FName = @FName, LName = @LName, ActiveFlag = @ActiveFlag, GroupId = @GroupId
    WHERE LoweredUserName = LOWER(@UserName)
END
like image 797
Chris Avatar asked Dec 14 '22 04:12

Chris


1 Answers

Looks like it might not exist yet, swap the Alter to a Create.

like image 193
Martynnw Avatar answered May 13 '23 23:05

Martynnw