What is the exact error you are getting?
John Daisley
MySQL & Cognos Contractor
Certified MySQL 5 Database Administrator (CMDBA)
Certified MySQL 5 Developer (CMDEV)
IBM Cognos BI Developer
Telephone +44 (0)7812 451238
Email john@stripped
-----Original Message-----
From: Sharique uddin Ahmed Farooqui [mailto:safknw@stripped]
Sent: 04 October 2009 19:18
To: mysql
Subject: error creating table
Hi,
I'm trying to create a table with 2 columns both are primary key
(combined) and both are foreign key as well. I'm getting error cannot
create table. Here is the sql
CREATE TABLE `userroles` (
`roleid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`userid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`roleid`, `userid`),
INDEX `FK1_user` (`userid`),
CONSTRAINT `fk_userid` FOREIGN KEY (`userid`) REFERENCES `users`
(`userid`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `fk_roleid` FOREIGN KEY (`roleid`) REFERENCES `roles`
(`roleid`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE=utf8_general_ci
ENGINE=InnoDB
ROW_FORMAT=COMPACT
AVG_ROW_LENGTH=0
--
Sharique uddin Ahmed Farooqui
(C++/C# Developer, IT Consultant)
http://safknw.blogspot.com/
"Peace" is the Ultimate thing we want.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.14.3/2413 - Release Date: 10/04/09 06:20:00