Inserting a date field into SQL 
Author Message
 Inserting a date field into SQL

I have been using MySQL for about 12 months now for some web
applications I was writing, so I thought I was familiar with SQL syntax.
I am now playing around with some SQL stuff in VB.
I am having problems inserting a value into a date type field. No matter
what I try I get a 'syntax error in insert into statement' error
message. I am trying to insert data into an access file. I only get the
error when inserting date fields.
What is the secret????
What am I missing????
What has Anna Kournakova done to change her serving game????
If anyone could find it in their heart to answer these questions I would
be most grateful.

Thanks.........



Tue, 24 Jul 2001 03:00:00 GMT  
 Inserting a date field into SQL
Try enclosing dates within # chartacters ie Where DATE = #5/6/99 10:45:30#
Quote:

> I have been using MySQL for about 12 months now for some web
> applications I was writing, so I thought I was familiar with SQL syntax.
> I am now playing around with some SQL stuff in VB.
> I am having problems inserting a value into a date type field. No matter
> what I try I get a 'syntax error in insert into statement' error
> message. I am trying to insert data into an access file. I only get the
> error when inserting date fields.
> What is the secret????
> What am I missing????
> What has Anna Kournakova done to change her serving game????
> If anyone could find it in their heart to answer these questions I would
> be most grateful.

> Thanks.........



Tue, 24 Jul 2001 03:00:00 GMT  
 Inserting a date field into SQL
It depends on what data base your sending the sql command from, in access or
the Jet Engine you use # around the date or time (eg #12/31/98#)
If you working with a Microsoft SQL Server database its ' around the date
(eg '12/31/98')

I'm not familiar with mysql but i would think that this would be pretty
close
Matt

Quote:

>I have been using MySQL for about 12 months now for some web
>applications I was writing, so I thought I was familiar with SQL syntax.
>I am now playing around with some SQL stuff in VB.
>I am having problems inserting a value into a date type field. No matter
>what I try I get a 'syntax error in insert into statement' error
>message. I am trying to insert data into an access file. I only get the
>error when inserting date fields.
>What is the secret????
>What am I missing????
>What has Anna Kournakova done to change her serving game????
>If anyone could find it in their heart to answer these questions I would
>be most grateful.

>Thanks.........



Tue, 24 Jul 2001 03:00:00 GMT  
 Inserting a date field into SQL

Quote:

>I am trying to insert data into an access file. I only get the
>error when inserting date fields.

 "... SET Birthdate = " & Format$(dtBirthday, "#yyyy-mm-dd#")

Remember you can't use dd/mm/yyyy ...

Tim F

--



Wed, 25 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Insert date and time field into MS Access with SQL

2. Insert date type varible through ODBC SQL server driver to SQL 7.0 database

3. Sql, make string field a date field.

4. Inserting current date into a contact's note field

5. Insert current date into form fields

6. Problem inserting record with date field

7. INSERT INTO and UPDATE date field

8. INSERT query fails with date field

9. How to Insert a Record with a Date Field into FoxPro

10. Problem inserting record with date field

11. Insert #NULL# into Date field causes datatype mismatch error

12. SQL: Inserting Date values From VB5 Into Access DB

 

 
Powered by phpBB® Forum Software