SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Jun 2, 2004, 08:49 #1
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
What is wrong with this create statement?
I have the following query:
Code:CREATE TABLE special( sp_p_id int( 5 ) NOT NULL , sp_desc text NULL , sp_rates set( 'true', 'false' ) NOT NULL DEFAULT 'true', sp_home set( 'true', 'false' ) NOT NULL DEFAULT 'false', FOREIGN KEY sp_p_id REFERENCES product( p_id ) ON DELETE CASCADE ) TYPE = InnoDB
ssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
-
Jun 2, 2004, 12:04 #2
- Join Date
- Jan 2004
- Location
- Uppsala, sverige
- Posts
- 700
- Mentioned
- 2 Post(s)
- Tagged
- 1 Thread(s)
Code:FOREIGN KEY (sp_p_id) REFERENCES product( p_id ) ON DELETE CASCADE
-
Jun 2, 2004, 14:25 #3
- Join Date
- Jan 2001
- Location
- buried in the database shell (Washington, DC)
- Posts
- 1,107
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If the above does not work make sure your MySQL version supports ON DELETE .. ,
Matt - Sybase DBA / PHP fanatic
Sybase/MySQL/Oracle | I don't like MySQL
Download Sybase | DBForums.com - for all your RDBMS talk
-
Jun 2, 2004, 22:09 #4
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
Yeah, it was the () around sp_p_id...
I caught it about 10 minutes after I made the post.
Now I have to figure out how to implement foreign keys since my host doesn't support InnoDBssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
Bookmarks