How to change multiple columns to enum

Und alles was mit phpMyAdmin seine Verwandtschaft findet hat hier seinen Platz.

How to change multiple columns to enum

Postby cinci_hal » 30. July 2012 20:45

I imported an MS Access database table to phpMyAdmin and several of the table columns are INT. I want to change them to enum('0','1') with default of 0. I am new to phpMyAdmin and was wondering if there is a way to change them all at once?
cinci_hal
 
Posts: 2
Joined: 30. July 2012 20:35
XAMPP Version: 1.8.0
Operating System: window 7

Re: How to change multiple columns to enum

Postby Altrea » 30. July 2012 21:19

Hi cinci_hal (there is ALWAYS time for a short salutation. You are asking for help here on a community board and therefor it would be very polite to start with a hello),

cinci_hal wrote:I want to change them to enum('0','1') with default of 0.

For boolean values i would choose the column type Bit(1) or maybe Tinyint(1), but not Enum.

cinci_hal wrote:I am new to phpMyAdmin and was wondering if there is a way to change them all at once?

With phpmyadmin you can change the structure of a full data table.
To change all columns you have to write your orn custom SQL query.

best wishes,
Altrea
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
free software according to purpose of usage
XAMPP 1.8 for local development/testing only
Zend Server 6 (free) for production environments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 4496
Joined: 17. August 2009 13:05
XAMPP Version: 1.8.0
Operating System: W7Ux64

Re: How to change multiple columns to enum

Postby cinci_hal » 30. July 2012 21:49

Thanks for the welcome!

I have tried to write a query with no possitive results. I should have mentioned that I am also new to sql. I have been googling and I think I am close to figuring it out, but just need a little bit of help. I think the query will look something like this:

UPDATE project_type SET Type = enum('0','1') Default = 0
WHERE record_id = `COL 5`, `COL 6`, etc.

If I could get some addition help on this it would be much appreciated.
cinci_hal
 
Posts: 2
Joined: 30. July 2012 20:35
XAMPP Version: 1.8.0
Operating System: window 7

Re: How to change multiple columns to enum

Postby Altrea » 30. July 2012 23:52

cinci_hal wrote:Thanks for the welcome!

That wasn't just a hello from me to you but also a hint that YOU should start a new thread with a salutation.

cinci_hal wrote:I think the query will look something like this:[

UPDATE project_type SET Type = enum('0','1') Default = 0
WHERE record_id = `COL 5`, `COL 6`, etc.

No, UPDATE table is not the syntax you need.
What you need is ALTER table

best wishes,
Altrea
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
free software according to purpose of usage
XAMPP 1.8 for local development/testing only
Zend Server 6 (free) for production environments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 4496
Joined: 17. August 2009 13:05
XAMPP Version: 1.8.0
Operating System: W7Ux64


Return to phpMyAdmin

Who is online

Users browsing this forum: No registered users and 0 guests