CREATE TABLE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zufie

    CREATE TABLE

    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_rating s
    (
    location VARCHAR(50),
    time DATETIME,
    date DATE,
    type CHAR(6),
    rating VARCHAR(50)
    comments VARCHAR(50)
    );

    How can I fix my code?

    Thanks,

    John
  • KC-Mass

    #2
    Re: CREATE TABLE

    On Nov 19, 2:59 pm, zufie <john.marru...@ illinois.govwro te:
    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_rating s
    (
    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

    Comment

    • zufie

      #3
      Re: CREATE TABLE

      On Nov 19, 1:59 pm, zufie <john.marru...@ illinois.govwro te:
      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_rating s
      (
      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_rating s
      (
      location VARCHAR(50),
      e datetime,
      d date,
      type CHAR(6),
      rating VARCHAR(50),
      comments VARCHAR(50)
      );

      John

      Comment

      Working...