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 ? Quote Link to comment 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] Quote Link to comment 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 :-* Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.