Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Post Unanswered: Cannot insert value NULL into a column

    I have a table that the user require a new sequencial id# which I provided with a new_id. The old one is still there but for all purposes it's not being used. The records and querys all work fine. but when attempting to add new records this error message comes up. "Cannot insert value NULL into column New_Plan_ID;table MonirotyingSQL.dbo.tblMonitoringPrograms''column does not allow null, insert fails. Please help

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Assuming that your new usable ID field is called new_id, and your unused one is called New_Plan_ID, why don't you just take off the requirement for the non-nullability of new_id
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    error message

    Please take a look
    Attached Thumbnails Attached Thumbnails error.jpg  

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Not sure if you have rights on this table from Access. I would doubt it because it looks like a linked SQL Server table.

    Old_Plan_ID:

    If this field is required for back-up referencing or something, have the DBA change this to a basic int field. Nullable, no longer an identity. If I remember (if this is SQL Server) correctly, this field should not require these modifications as it already knows how to increment itself.

    If the field is truly not used by absolutely anyone at all (note the doubts when using absolutes), have the DBA remove the field.

    New_Plan_ID:

    I can't see the field definition for new_plan_id other than it is a primary key. Are the identity, and Identity Increment properties set in a similar manner? If they are, post the most simple SQL insert into statement that generates this error.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Re: Cannot insert value NULL into a column

    Are there any records present that will still rely on that Old_Plan_ID? Check how the Tables are structures as pertaining to Relationships. If another table is tied to that with the Old_Plan_ID you need to find a way to get the New_Plan_ID into the table for a foreign key then break the chain with the Old one. Look into that first...sounds like something is not quite put together well.

    Bud

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •