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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.