Jump to content

what's wrong with this ?


live_ex3me

Recommended Posts

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 instead
Error Number : 1171[/b]

any help ?
Link to comment
https://forums.phpfreaks.com/topic/20137-whats-wrong-with-this/
Share on other sites

[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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.