MySQL query

Hi All,

I am not able to create Table Partition on MySQL DB because of below error. Please advise how to fix below error.

Error: "SQL Error (1054): Unknown column 'xUPD_A50000' in 'partition function' "

Table structure and Partition script:
CREATE TABLE `Temp_T` (
	`ID` VARCHAR(20) NOT NULL,
	`DATE_WORKED` VARCHAR(20) NOT NULL,
	`ACTUAL_DATE_ENTERED` VARCHAR(20) NULL DEFAULT NULL,
	PRIMARY KEY (`ID`)
)
PARTITION BY RANGE(ID) (
        PARTITION p0 VALUES LESS THAN (xUPD_A50000), 
        PARTITION p1 VALUES LESS THAN (xUPD_A100000), 
        PARTITION p2 VALUES LESS THAN (xUPD_A150000), 
       PARTITION p3 VALUES LESS THAN (xUPD_B50000), 
        PARTITION p4 VALUES LESS THAN (xUPD_B100000), 
        PARTITION p5 VALUES LESS THAN (xUPD_B150000), 
        PARTITION p6 VALUES LESS THAN (MAXVALUE)
);

Sample data:
ID                                     DATE_WORKED                               ACTUAL_DATE_ENTERED
===============================================================
xUPD_A50000               2013-01-01                                            2013-06-01
xUPD_A51000                2013-01-01                                           2014-09-06
xUPD_B80000               2003-07-03                                             2011-05-06
xUPD_B150000             2004-07-01                                              2002-03-01

Open in new window

sqldba2013Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
You need to enclose the string literal values in apostrophe:
CREATE TABLE `Temp_T` (
	`ID` VARCHAR(20) NOT NULL,
	`DATE_WORKED` VARCHAR(20) NOT NULL,
	`ACTUAL_DATE_ENTERED` VARCHAR(20) NULL DEFAULT NULL,
	PRIMARY KEY (`ID`)
)
PARTITION BY RANGE(ID) (
        PARTITION p0 VALUES LESS THAN ('xUPD_A50000'), 
        PARTITION p1 VALUES LESS THAN ('xUPD_A100000'), 
        PARTITION p2 VALUES LESS THAN ('xUPD_A150000'), 
       PARTITION p3 VALUES LESS THAN ('xUPD_B50000'), 
        PARTITION p4 VALUES LESS THAN ('xUPD_B100000'), 
        PARTITION p5 VALUES LESS THAN ('xUPD_B150000'), 
        PARTITION p6 VALUES LESS THAN ('MAXVALUE')
);

Open in new window

0
stevejacob68Commented:
Hi,

Always add string in apostrophe. If user does not define string in apostrophe, then code could result in error. Same problem is occurred in your database.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sqldba2013Author Commented:
Thanks for your suggestions and I have created Table Partition on my environment as per my requirement.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.