INSERT date into Access table

K

Kok Yong Lee

Hi there,

I am having a bit of problem in populating a table with date as one of its
columns.

myTable
-----------
id | label | date


where my SQL string to populate the table from Perl is

INSERT INTO myTable (label, date) VALUES ('blahblah.', '3/20/2007')

I am getting some generic error

SQL ERROR:
Error: [-3502] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Syntax
error in INSERT INTO statement."

If I only populate the label column then it works.

Any idea where I got my SQL syntax wrong?

thanks.
 
M

Matt

Hi there,

I am having a bit of problem in populating a table with date as one of its
columns.

myTable
-----------
id | label | date

where my SQL string to populate the table from Perl is

INSERT INTO myTable (label, date) VALUES ('blahblah.', '3/20/2007')

I am getting some generic error

SQL ERROR:
Error: [-3502] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Syntax
error in INSERT INTO statement."

If I only populate the label column then it works.

Any idea where I got my SQL syntax wrong?

thanks.

try:

INSERT INTO myTable (label, date) VALUES ('blahblah.', #3/20/2007#)
 
S

strive4peace

Hi Kok,

dates are delimited with # not quotes

also, Date is a reserved word, so you need to delimit it with brackets
when used as a fieldname

INSERT INTO myTable (label, [date]) SELECT 'blahblah.', #3/20/2007#;


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
S

strive4peace

you're welcome, Kok ;) happy to help


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top