Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004

    Unanswered: Insert conundrum

    I'm trying to run a query from an .asp page, adding records to a table in SQL 7. Now I created this table in Access and moved it over to SQL 7. There's a Counter field and a Date/time field that auto-number and auto-date. However, when I fill out the web form and hit submit I get a

    Cannot insert the value NULL into column 'Counter', table 'whatever'; column does not allow nulls. INSERT fails.

    If I change properties in SQL 7 to allow nulls, I can add records but it will not
    autonumber. Moreover, no date happens either.

    No... neither counter nor the date/time filed are stipulated in the Insert statement. The example I used in creating the SQL statement manages the task in another database without any mention of these fields... you get autonumbering and a date. I simply am at the end of my rope trying to figure out what the problem is.

    Thanks in advance and sorry for the clueless newb question.

  2. #2
    Join Date
    Jul 2003
    San Antonio, TX
    You need to change IDENTITY property for the former AUTONUMBER field (right-mouse click on the table and go to design). And while you're in Table Design, go to DEFAULT property of your date/time field and put either GETDATE() or CURRENT_TIMESTAMP for the default value. No code changes required.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Oct 2004
    Thank you very much. It's working. Yay.

Posting Permissions

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