Put single quotes around your DATE variables.

Alex


----- Original Message ----- 
From: "Geoff Hoffman" <[EMAIL PROTECTED]>
To: "SQL" <[EMAIL PROTECTED]>
Sent: Friday, April 13, 2001 11:59 AM
Subject: INSERT INTO (access mdb table) PROBLEM


> Thanks for the pointers from migrating Access to SQL, John.
> 
> Today I have a new question.
> 
> I am developing a CF Web App and am having a bear of a time ONLY 
> with INSERT INTO statements.
> 
> For example,
> 
> In an Access MDB I have the following table (named "content"):
> guid (VARCHAR 16)
> type_id (SMALLINT 2)
> client_id (SMALLINT 2)
> user_id (SMALLINT 2)
> logdate (DATETIME 16)
> birthdate (DATETIME 16)
> expirationdate (DATETIME 16)
> 
> which is recordless at the time of testing.
> 
> I have the following query on a CF page:
> 
> <cfquery name="perm_write_content" datasource="#Application.dsn#" 
> dbtype="ODBC">
> INSERT INTO content(guid, 
> type_id, 
> client_id, 
> user_id, 
> logdate, 
> birthdate, 
> expirationdate)
> VALUES('#temp.guid#', 
> #temp.content_type_id#, 
> #temp.client_id#,
> #getuserid.user_id#, 
> #Now()#, 
> #ParseDateTime(temp.birth_date)#, 
> #ParseDateTime(temp.expiration_date)#);
> </cfquery>
> 
> 
> It is throwing the following error:
> 
> ODBC Error Code = 37000 (Syntax error or access violation)
> 
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT 
> INTO statement.
> 
> SQL = "INSERT INTO content (guid, type_id, client_id, user_id, logdate,
> birthdate, expirationdate) VALUES ('ADOUTV2Y', 1, 2, 1, {ts '2001-
> 04-13 10:24:48'}, {ts '2001-01-01 00:00:00'}, {ts '2099-12-31 23:
> 59:59'});"
> 
> It all seems to be syntactically correct -- any pointers? 
> 
> I tried everything I could think of; the only way I can get INSERT 
> INTO statements working is by NOT NAMING the columns, which is, for 
> obvious reasons, not ideal. If I explicity name the columns, it throws 
> an error every time. BtW, the columns all are not required and do 
> allow zero length values, but as you can see, I am naming every column 
> and providing what appears to be the proper data type, yet it throws 
> an error.
> 
> Thanks in advance,
> 
> Geoff Hoffman
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> 
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to