Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    3

    Unanswered: Help! Cannot Insert Null

    Hello Everyone,
    This is my first time here.
    I have been trying to turn off the "null" property for my id column.
    And then I put yes for identity.
    when i go to save it i get the error message,
    "Cannot insert the value NULL into column 'ID'"
    Can someone please help me out with this, its probably something simple, but i just cant figure it out.

    Thanks,
    PJ

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Identity values are create automatically by the server. They cannot be NULL.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Feb 2005
    Posts
    3
    for some reason, the property in the ID column showed as "null"
    but it should NOT be
    when i uncheck the box for null and set the identity for yes, i get that error.
    i have a username/password thing on the website, and when someone registers, it DOES insert all the information from the form, but under the ID column, instead, where it USED to give it a number, it says <null>.
    i can go in manually and enter a number, and then it works, but i need the ID to be automatically added.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    A check in the "Allow Nulls" column indicates that the field will accept Null values, not that it will exclude them.

    You cannot set the Identity property on a field that allows Nulls. If you try, it will automatically set the field to disallow null values.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Feb 2005
    Posts
    3
    I happened to figure this out
    What happened:
    There were already null "id's" created/inserted into the table
    you have to delete those that were created by null, and THEN you can uncheck the "allow nulls" and set the identity to yes
    My whole problem was trying to NOT allow nulls, but once nulls are created in the table, you cannot uncheck the box

    Thank you so much for your help though.

    -PJ

Posting Permissions

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