www.webdeveloper.com
Results 1 to 3 of 3

Thread: create table syntax error

  1. #1
    Join Date
    May 2007
    Posts
    43

    create table syntax error

    Hello everyone:

    I want to create a table in DOS command line prompt.

    I received a syntax error message but I couln't find out what caused the error.

    Could somone take look at my 'create table' syntax and tell me what I did wrong?

    I appreciate your help!


    PHP Code:
    create table computers(
      
    emp_id int unsigned not null auto_increment,
      
    pc_name varchar(50not null,
      
    current_user varchar(50not null,
      
    act_key varchar(50),
      
    ms_office_key varchar(50),
      
    norton_order_num varchar(50),
      
    serial_num varchar(50),
      
    make varchar(50not null,
      
    model varchar(50not null,
      
    OS varchar(50not null,
      
    purchase_date datetime not null,
      
    in_use varchar(1not null,
      
    location varchar(50not null,
      
    product_num varchar(50not null,
      
    os_key varchar(50not null,
      
    primary key (emp_id)); 
    ---------- Error Message --------------------------
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
    for the right syntax to use near 'current_user varchar(50) not null,
    act_key varchar(50),
    ms_office_key varchar(' at line 4

    webdev077
    3-2-07

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,430
    "current_user" is a MySQL reserved word, so you'll need to quote it (with `back ticks`) if you want to use it as a column name. (Thus it can be a useful habit to always quote table and column names.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    May 2007
    Posts
    43

    resolved Problem solved

    Hello NogDog:

    Thanks for pointing out my problem. I modified the reserved keyword and I was able to crate the table.

    Quote Originally Posted by NogDog
    "current_user" is a MySQL reserved word, so you'll need to quote it (with `back ticks`) if you want to use it as a column name. (Thus it can be a useful habit to always quote table and column names.)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles