If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > create table command syntax error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-08, 13:43
sjgrad03 sjgrad03 is offline
Registered User
 
Join Date: Aug 2003
Location: san jose, CA
Posts: 68
create table command 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 figure 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

sjgrad03
3-2-08
Reply With Quote
  #2 (permalink)  
Old 03-03-08, 03:31
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
I have a feeling "current_user" might be a reserved word. Try putting the column names in backticks (`),

i.e.
Code:
create table computers(
  emp_id int unsigned not null auto_increment,
  pc_name varchar(50) not null,
  `current_user` varchar(50) not null,
  act_key varchar(50),
  ms_office_key varchar(50),
  norton_order_num varchar(50),
  serial_num varchar(50),
  make varchar(50) not null,
  model varchar(50) not null,
  OS varchar(50) not null,
  purchase_date datetime not null,
  in_use varchar(1) not null,
  location varchar(50) not null,
  product_num varchar(50) not null,
  os_key varchar(50) not null,
  primary key (emp_id)
);
Reply With Quote
  #3 (permalink)  
Old 03-03-08, 03:36
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by aschk
I have a feeling "current_user" might be a reserved word. Try putting the column names in backticks (`)
I would highly recommend not using a reserved word at all, it just creates too many problems.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On