Re: Alter Column Name?

2005-06-13 Thread Jigal van Hemert
From: "Scott Purcell"
> I cannot find any information on this, so I am thinking the answer is no.
But I have a column that I would like to change the name of:
>
> current the column name is"ID", and I would like it to change it to
"CHILD_ID", as the the software is changing, and we are adding  "parent_id"
column.

Answer is yes ;-)

For example:

ALTER TABLE `tablename` CHANGE `ID` `CHILD_ID` INT(14) NOT NULL DEFAULT '0';

So you must repeat the original column definition after the new name.
http://dev.mysql.com/doc/mysql/en/alter-table.html

Regards, Jigal.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Alter Column Name?

2005-06-13 Thread J.R. Bullington
Why not just 

ALTER TABLE tbl_Foo CHANGE `ID` `CHILD_ID` <>

Since I don't know the rest of your options or what you want to change the
column to, that's just for the name change. 

J.R.
 

-Original Message-
From: Rhino [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 13, 2005 4:56 PM
To: Scott Purcell; mysql@lists.mysql.com
Subject: RE: Alter Column Name?

I'm not sure if this will work for a column name but there is a CHANGE
COLUMN feature in the  ALTER TABLE statement so that sounds promising. Then
again, I don't have a MySQL system to try it on this week - I am travelling
- so I can't be sure if it will work for the column name.

Rhino

-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 1:00 PM
To: mysql@lists.mysql.com
Subject: Alter Column Name?


I cannot find any information on this, so I am thinking the answer is no.
But I have a column that I would like to change the name of:

current the column name is"ID", and I would like it to change it to
"CHILD_ID", as the the software is changing, and we are adding  "parent_id"
column.

Thanks,
Scott

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



smime.p7s
Description: S/MIME cryptographic signature


RE: Alter Column Name?

2005-06-13 Thread Rhino
I'm not sure if this will work for a column name but there is a CHANGE
COLUMN feature in the  ALTER TABLE statement so that sounds promising. Then
again, I don't have a MySQL system to try it on this week - I am
travelling - so I can't be sure if it will work for the column name.

Rhino

-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 1:00 PM
To: mysql@lists.mysql.com
Subject: Alter Column Name?


I cannot find any information on this, so I am thinking the answer is no.
But I have a column that I would like to change the name of:

current the column name is"ID", and I would like it to change it to
"CHILD_ID", as the the software is changing, and we are adding  "parent_id"
column.

Thanks,
Scott

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]