Connecting Tech Pros Worldwide Help | Site Map

CREATE TABLE

  #1  
Old November 19th, 2008, 08:05 PM
zufie
Guest
 
Posts: n/a
I am learning SQL using MS Access until I get SQL Server.

I am trying to create a table that includes time and date columns.

I receive the error: Syntax error in field definition.

Here is my code:

CREATE TABLE doughnut_ratings
(
location VARCHAR(50),
time DATETIME,
date DATE,
type CHAR(6),
rating VARCHAR(50)
comments VARCHAR(50)
);

How can I fix my code?

Thanks,

John
  #2  
Old November 19th, 2008, 08:35 PM
KC-Mass
Guest
 
Posts: n/a

re: CREATE TABLE


On Nov 19, 2:59 pm, zufie <john.marru...@illinois.govwrote:
Quote:
I am learning SQL using MS Access until I get SQL Server.
>
I am trying to create a table that includes time and date columns.
>
I receive the error: Syntax error in field definition.
>
Here is my code:
>
CREATE TABLE doughnut_ratings
(
location VARCHAR(50),
time DATETIME,
date DATE,
type CHAR(6),
rating VARCHAR(50)
comments VARCHAR(50)
);
>
How can I fix my code?
>
Thanks,
>
John
Hi John

I believe your field names of Time, Date and Type are reserved words
in Access. Try simply changing them to "ThisDate", "ThisTime", etc

Regards

Kevin
  #3  
Old November 19th, 2008, 08:45 PM
zufie
Guest
 
Posts: n/a

re: CREATE TABLE


On Nov 19, 1:59*pm, zufie <john.marru...@illinois.govwrote:
Quote:
I am learning SQL using MS Access until I get SQL Server.
>
I am trying to create a table that includes time and date columns.
>
I receive the error: Syntax error in field definition.
>
Here is my code:
>
CREATE TABLE doughnut_ratings
(
location VARCHAR(50),
time DATETIME,
date DATE,
type CHAR(6),
rating VARCHAR(50)
comments VARCHAR(50)
);
>
How can I fix my code?
>
Thanks,
>
John
Got code to work using MS Access.

Though MS Access did NOT like my use of the column names time and date
so I changed them to e and d, respectively

Here is my code:

CREATE TABLE doughnut_ratings
(
location VARCHAR(50),
e datetime,
d date,
type CHAR(6),
rating VARCHAR(50),
comments VARCHAR(50)
);

John
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Table Owner using CREATE TABLE, INSERT, SELECT & DROP TABLE Peter Nurse answers 6 November 21st, 2006 07:25 PM
CREATE TABLE AS - not materialized? Bruce answers 6 November 12th, 2005 07:36 AM
Create table from Text Karen Sullivan answers 2 July 23rd, 2005 10:09 AM
SP To create table Michael Jackson answers 4 July 23rd, 2005 09:12 AM
CREATE TABLE problem Andrew answers 3 July 17th, 2005 12:44 AM