Skip to content
Advertisement

Invalid object name of stored procedure error

I have a stored procedure such as below :

CREATE PROCEDURE [dbo].[sp_InsertPumpsStatus] (
    @Frequency1        FLOAT,
    @Power1            FLOAT,
    @Db1               FLOAT,
    @Efficiency1       FLOAT,
    @Frequency2        FLOAT,
    @Power2            FLOAT,
    @Db2               FLOAT,
    @Efficiency2       FLOAT,
    @Frequency3        FLOAT = NULL,
    @Power3            FLOAT = NULL,
    @Db3               FLOAT = NULL,
    @Efficiency3       FLOAT = NULL,
    @Frequency4        FLOAT = NULL,
    @Power4            FLOAT = NULL,
    @Db4               FLOAT = NULL,
    @Efficiency4       FLOAT = NULL,
    @Frequency5        FLOAT = NULL,
    @Power5            FLOAT = NULL,
    @Db5               FLOAT = NULL,
    @Efficiency5       FLOAT = NULL,
    @Frequency6        FLOAT = NULL,
    @Power6            FLOAT = NULL,
    @Db6               FLOAT = NULL,
    @Efficiency6       FLOAT = NULL,
    @Frequency7        FLOAT = NULL,
    @Power7            FLOAT = NULL,
    @Db7               FLOAT = NULL,
    @Efficiency7       FLOAT = NULL,
    @Frequency8        FLOAT = NULL,
    @Power8            FLOAT = NULL,
    @Db8               FLOAT = NULL,
    @Efficiency8       FLOAT = NULL,
    @Frequency9        FLOAT = NULL,
    @Power9            FLOAT = NULL,
    @Db9               FLOAT = NULL,
    @Efficiency9       FLOAT = NULL,
    @Frequency10       FLOAT = NULL,
    @Power10           FLOAT = NULL,
    @Db10              FLOAT = NULL,
    @Efficiency10      FLOAT = NULL,
    @SolarDateTime     NVARCHAR(20),
    @Date              DATETIME
)
AS
BEGIN
    INSERT INTO [dbo].sp_InsertPumpsStatus
      (
        [Frequency1],
        [Power1],
        [Db1],
        [Efficiency1],
        [Frequency2],
        [Power2],
        [Db2],
        [Efficiency2],
        [Frequency3],
        [Power3],
        [Db3],
        [Efficiency3],
        [Frequency4],
        [Power4],
        [Db4],
        [Efficiency4],
        [Frequency5],
        [Power5],
        [Db5],
        [Efficiency5],
        [Frequency6],
        [Power6],
        [Db6],
        [Efficiency6],
        [Frequency7],
        [Power7],
        [Db7],
        [Efficiency7],
        [Frequency8],
        [Power8],
        [Db8],
        [Efficiency8],
        [Frequency9],
        [Power9],
        [Db9],
        [Efficiency9],
        [Frequency10],
        [Power10],
        [Db10],
        [Efficiency10],
        [SolarDateTime],
        [Date]
      )
    VALUES
      (
        @Frequency1,
        @Power1,
        @Db1,
        @Efficiency1,
        @Frequency2,
        @Power2,
        @Db2,
        @Efficiency2,
        @Frequency3,
        @Power3,
        @Db3,
        @Efficiency3,
        @Frequency4,
        @Power4,
        @Db4,
        @Efficiency4,
        @Frequency5,
        @Power5,
        @Db5,
        @Efficiency5,
        @Frequency6,
        @Power6,
        @Db6,
        @Efficiency6,
        @Frequency7,
        @Power7,
        @Db7,
        @Efficiency7,
        @Frequency8,
        @Power8,
        @Db8,
        @Efficiency8,
        @Frequency9,
        @Power9,
        @Db9,
        @Efficiency9,
        @Frequency10,
        @Power10,
        @Db10,
        @Efficiency10,
        @SolarDateTime,
        @DATE
      )
END

when I execute this procedure, I get an error:

Invalid object name ‘dbo.sp_InsertPumpsStatus’

What is problem?

Advertisement

Answer

Invalid object name 'dbo.sp_InsertPumpsStatus'.

In your script, It can be clearly seen that, You are giving same name to the stored procedure as the table in statement. Make sure the defined table on Insert statement is correct. If it is correct, Give another name to the stored procedure.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement