this means you cannot place a NULL value into the ID column...either put something in it through your query or re-design your table to allow NULL values for the ID column
That said and ID column should NEVER contain a NULL value. Beyond that if the ID field is supposed to be the primary key for the table (which I assume it is) then you should either use the identity to increment that ID field with every new record added (there are other methods as well...but that is the easiest). HTH Bryan Stevenson VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. [EMAIL PROTECTED] --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com ----- Original Message ----- From: "Judy" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 1:47 PM Subject: error msg for cfquery > I have a form to insert a new record into my SQL database. But when I click Submit, >I get this error message: > > ODBC Error Code = 23000 (Integrity constraint violation) > > > [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into >column 'ID', table 'Events.dbo.DATES'; column does not allow nulls. INSERT fails. > > > > The error occurred while processing an element with a general identifier of >(CFQUERY), occupying document position (28:1) to (28:49). > > > Date/Time: 04/29/02 16:31:29 > Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) > Remote Address: 127.0.0.1 > HTTP Referrer: http://127.0.0.1/events/insertform.cfm?action=new > > > > My database has an EVENTS table with the primary key ID which is related to a DATES >table with the foreign key ID. I have the primary key hidden on my insert form. I was expecting that when I submitted a new record that it would add it using the next available record number for my primary key ID - and that when I typed a new date on my form, a new record would be added in that related table also. > > I don't think I can have any IDs NULL in my related table since later I'll want to >search by dates and pull out events by those dates. > > Can someone tell me what's wrong? > > Thanks, > > Judy > > > ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

