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 > Error in SQL syntax (REQUIRE)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-04, 02:06
marsulein marsulein is offline
Registered User
 
Join Date: Oct 2004
Posts: 3
Error in SQL syntax (REQUIRE)

Hi All,

I tried to execute this code and error pops up. I need to create a table field name REQUIRE however REQUIRE is a reserve command for mySQL. Anyone know how to deal with this?

CREATE TABLE TB_RFP_REQUIRE (
RFP_ID int(10) unsigned default NULL,
RFP_REQUIRE_ID int(10) unsigned default NULL,
REQUIRE varchar(80) default NULL
) TYPE=MyISAM;

Thanx in advance!

Regards,
Mar
Reply With Quote
  #2 (permalink)  
Old 10-11-04, 05:46
snorp snorp is offline
Registered User
 
Join Date: Apr 2004
Location: Europe->Sweden->Stockholm
Posts: 71
Quote:
Originally Posted by marsulein
I need to create a table field name REQUIRE however REQUIRE is a reserve command for mySQL. Anyone know how to deal with this?
Use another name. You can not name a variable "int" in C, "function" in PHP or "for" in Ada and you can not call a column "REQUIRE" in SQL. You need to call it something else. Reserved words are reserved, and there is no way around it. Why can't you just use another name?
Reply With Quote
  #3 (permalink)  
Old 10-11-04, 07:13
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
just use backticks, e.g. `REQUIRE`
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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