SQL Server Performance

Insert Error: Column name or number of supplied values does not match table definition.

Discussion in 'SQL Server 2005 General Developer Questions' started by TanuSaran, Apr 16, 2009.

  1. TanuSaran New Member

    Hi,
    Can someone help me on this error, which says
    Insert Error: Column name or number of supplied values does not match table definition.
    The stored procedure has been inserting values since years but now it thows error .Please help how to debug.
    Regards
    Tanu
  2. techbabu303 New Member

    - has anything changed like new metadata release.
    - Check if the table which the stored procdeure is referencing. If you can post the code and table desc it would be helpful for forum members to assist.
    -sat
  3. dhamu294 New Member

    Hi,
    some colum might be added or removed in you table schema.
    check the columns in sp and schema it will work.
  4. Madhivanan Moderator

    [quote user="TanuSaran"]
    Hi,
    Can someone help me on this error, which says
    Insert Error: Column name or number of supplied values does not match table definition.
    The stored procedure has been inserting values since years but now it thows error .Please help how to debug.
    Regards
    Tanu
    [/quote]
    This is one of the reasons
    that
    insert statements should include column names likeInsert
    into table_name(col1,col2,...)
  5. atulmar New Member

    Number of column specified in insert list do not match number of columns in values list.
    Ex. INSERT <table> (A,B,C) VALUES ('A','B') or INSERT <table> (A,B) VALUES ('A','B','C')
    This is very common error when we don't specify the column list in INSERT statements.
  6. TanuSaran New Member

    no the table is used since last few years and there has been no change in the table defination ...
    the code is something like
    Insert into <table> EXEC sp_search
    which worked fine till four days back
    Re
    Tanu
  7. atulmar New Member

    Can you execute the procedure sp_search seperately, and see the number of columns?
  8. TanuSaran New Member

    Yes . I can and even the number of columns are same as in the insert table
  9. satya Moderator

    Are you trying to execute the script using your own CODE, TABLE & SCHEMA or is it by using any system stored procedures to a table?

Share This Page