live_ex3me Posted September 8, 2006 Share Posted September 8, 2006 hi there.. i have this code:[code]CREATE TABLE " . TABLE_PREFIX . "deletionlog ( primaryid INT UNSIGNED NOT NULL DEFAULT '0', type ENUM('post', 'thread') DEFAULT 'post', userid INT UNSIGNED NOT NULL DEFAULT '0', username VARCHAR(100) NOT NULL DEFAULT '', reason VARCHAR(125) NOT NULL DEFAULT '', PRIMARY KEY (primaryid, type))[/code]but.. it doesn't work.. it gives me this error:[b]MySQL Error : All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE insteadError Number : 1171[/b]any help ? Link to comment https://forums.phpfreaks.com/topic/20137-whats-wrong-with-this/ Share on other sites More sharing options...
shoz Posted September 8, 2006 Share Posted September 8, 2006 If you want the PRIMARY KEY to be on BOTH "primary_id" and "type" then you have to make type NOT NULL as well.[code]ALTER TABLE tablename MODIFY type ENUM('post', 'thread') NOT NULL DEFAULT 'post',[/code] Link to comment https://forums.phpfreaks.com/topic/20137-whats-wrong-with-this/#findComment-88524 Share on other sites More sharing options...
live_ex3me Posted September 8, 2006 Author Share Posted September 8, 2006 [quote author=shoz link=topic=107367.msg430729#msg430729 date=1157734766]If you want the PRIMARY KEY to be on BOTH "primary_id" and "type" then you have to make type NOT NULL as well.[code]ALTER TABLE tablename MODIFY type ENUM('post', 'thread') NOT NULL DEFAULT 'post',[/code][/quote]thanx a lot :-* Link to comment https://forums.phpfreaks.com/topic/20137-whats-wrong-with-this/#findComment-88530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.