Forum Moderators: coopster & phranque

Message Too Old, No Replies

MSAcess/SQL statement

Date/Time timestamp

         

Big_Perm

11:23 am on Aug 28, 2001 (gmt 0)



I'm trying to insert a timestamp into an access database. Does anyone know the syntax for something like...

INSERT_INTO table_name (date_time_field) VALUES (#" & Now() & "#);"

The #'s return an error as do single quotes and having nothing. Anyone know the syntax?

rpking

12:32 pm on Aug 28, 2001 (gmt 0)

10+ Year Member



If you want to insert the current time, then instead of using an ASP variable, why not use a built in SQL command:

INSERT_INTO table_name (date_time_field) VALUES (CURRENT_TIMESTAMP());

I haven't tried this exact statement, but the CURRENT_TIMESTAMP() command returns the date and time on the SQL machine and I think it works in ACCESS. It is also a handy variable to use in date time comparisons...

eg SELECT ... WHERE Date < CURRENT_TIMESTAMP;

Big_Perm

12:43 pm on Aug 28, 2001 (gmt 0)



I was actually using a variable containing info from a form. When i put the field name in brackets, the problem was solved. It confused access because the field name was "time" which must be a keyword in access.