Insert Statement error

  • Im geting this error when im doing my insert statement

    INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK__NUMBERS__NUM_T__08EA5793'. The conflict occurred in database 'Project', table 'NUM_TYPE', column 'NUM_TYPE_ID'. The statement has been terminated.

    My Primary Table [NUM_TYPE] has NUM_TYPE_ID (P.Key), NUM_TYPE_NAME colums

    I have following records inside my NUM_TYPE Table.

    T1, Type 1

    T2, Type 2

    T3, Type 3

    T4, Type 4

    My other table [NUM] has NUM_ID (P.Key), NUM_TYPE_ID (F.Key), NUM1,NUM2,NUM3,NUM4,NUM5 columns.

    When I do an Insert Statement via a S.P into my NUM table. I am getting this error.

    INSERT INTO NUM VALUES ('12','T1','2','3','4','5','6')

  • Insert into dbo.Num (Col order here), values ...

  • why are u inserting a string '12' into a fld that is called NUM_ID (P.Key)? Wouldn't it be more logical to use integer type for this fld?

     

  • same applies I guess to cols NUM1,NUM2,NUM3,NUM4,NUM5 - whay to use string values for those?

  • raj - sergei's questions are valid ones...why are you using string values in what seem to be integer columns ?!

    also, could you pl. post the ddls of your 2 tables...specifically the datatypes of num_type_id!!!







    **ASCII stupid question, get a stupid ANSI !!!**

  • All are in integers in my DB.

  • raj - your num_type_name and num_type_id cannot possibly be integers if the values in them are 'T1' & 'Type 1'...

    also, if the number columns are integers, you seem to be passing strings to them - since they're enclosed in single quotes...

    could you please post the ddls of the 2 tables ?!







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply