Nel

Nel

  • NA
  • 716
  • 1m

Problem with insert procedure

Aug 24 2014 6:36 PM

Hello,

I want to insert data into sql data table but even though the fields exist in the database I get this error:

Msg 207, Level 16, State 1, Procedure insertIncid1, Line 53
Invalid column name 'Dayi'. and the same for PoD1 and 4 more

My procedure looks like this:


CREATE procedure insertIncid1
(
   @Date                DATETIME   ,
    @Day     nvarchar (15),
 @TimeFrom             NVARCHAR (5),
 @PoD1     nvarchar(2),
 @TimeTo      NVARCHAR (5),
 @PoD2      NVARCHAR (2),
    @Location            NVARCHAR (60)  ,
    @IncidentType        NVARCHAR (50)   ,
    @Direction           NVARCHAR (60)  ,
    @LaneBlockage        NVARCHAR (60)  ,
    @CCTV                NVARCHAR (60)   ,
    @SignalTimingChanges NVARCHAR (100) ,
    @Benefits            NVARCHAR (100)  ,
    @Latitude            DECIMAL (18, 6) ,
    @Longitude           DECIMAL (18, 6)

)
as
begin

INSERT INTO TrafInc1
(
Datei ,
    Dayi,
 TimeFrom,
 PoD1,
 TimeTo,
 PoD2,
    Location            ,
   IncidentType          ,
    Direction          ,
    LaneBlockage         ,
    CCTV                  ,
    SignalTimingChanges ,
    Benefits              ,
    Latitude            ,
   Longitude  )

VALUES
(
    @Date ,
    @Day,
 @TimeFrom,
 @PoD1,
 @TimeTo,
 @PoD2,
    @Location,
    @IncidentType,
    @Direction,
    @LaneBlockage,
    @CCTV ,
    @SignalTimingChanges,
    @Benefits,
    @Latitude,
    @Longitude
 )

   end


I didn't have that problem before And than I don't know what happened, what maybe I have unintentionally changed and now the insert procedure doesn't recognize these fields Yes, I did change the structure of the table, but the names are the same and the types as well

Here is the table

CREATE TABLE [dbo].[TrafInc1] (
    [IncidentID]          INT             IDENTITY (1, 1) NOT NULL,
    [Datei  ]             NVARCHAR (10)   NULL,
    [Dayi ]               NVARCHAR (15)   NULL,
    [TimeFrom ]           NVARCHAR (5)    NULL,
    [PoD1 ]               NVARCHAR (2)    NULL,
    [TimeTo ]             NVARCHAR (5)    NULL,
    [PoD2 ]               NVARCHAR (2)    NULL,
    [Location]            NVARCHAR (60)   NULL,
    [IncidentType]        NVARCHAR (50)   NULL,
    [Direction ]          NVARCHAR (60)   NULL,
    [LaneBlockage]        NVARCHAR (60)   NULL,
    [CCTV]                NVARCHAR (60)   NULL,
    [SignalTimingChanges] NVARCHAR (100)  NULL,
    [Benefits]            NVARCHAR (100)  NULL,
    [Latitude ]           DECIMAL (18, 6) NULL,
    [Longitude ]          DECIMAL (18, 6) NULL
);

Can anybody help me please what could be the problem?
Thanks


Answers (4)