I wasn't entirely sure what you wanted - do you want to change the
table's column names? If so, then do what the message below suggests.
And yes, you can do it all in one query:
alter table mytest
change my_1 my_file_1 varchar(5),
change my_2 my_file_2 varchar(5),
...and so on
See
http://www.mysql.com/doc/A/L/ALTER_TABLE.html
for more info.
If my_1, etc are VALUES in a column, and you want to modify them, you
can do this:
update your_table_name
set your_column_name =
concat('my_file_', substring(your_column_name, 4))
See
http://www.mysql.com/doc/S/t/String_functions.html
for more info.
-steve
At 2:32 PM -0400 7/2/02, Anil Garg wrote:
>thanx for ur mail, m sorry in dint mention that infact its a big table...
>Is there a way i can do it in all the columns using only one query ??
>thanx
>anil
>----- Original Message -----
>From: "nellA hciR" <[EMAIL PROTECTED]>
>To: "Anil Garg" <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Tuesday, July 02, 2002 2:14 PM
>Subject: Re: changing coulmn
>
>
>> mysql> create table mytest (
>> -> my_1 varchar(5)
>> -> );
>> Query OK, 0 rows affected (0.32 sec)
>>
> > mysql> alter table mytest change my_1 my_file_1 varchar(5);
>> Query OK, 0 rows affected (0.23 sec)
>> Records: 0 Duplicates: 0 Warnings: 0
>>
>> mysql> show columns from mytest;
>> +-----------+------------+------+-----+---------+-------+
>> | Field | Type | Null | Key | Default | Extra |
>> +-----------+------------+------+-----+---------+-------+
>> | my_file_1 | varchar(5) | YES | | NULL | |
>> +-----------+------------+------+-----+---------+-------+
>>
>> On Tuesday, July 2, 2002, at 09:36 , Anil Garg wrote:
>>
>> > in my table a column has enties
>> > my_1
>> > my_4
>> > my_5
>> >
>> > i wnat to change it to
>> > my_file_1
>> > my_file_4
>> > my_file_5
> >
>
--
+------------------------------------------------------------------------+
| Steve Edberg [EMAIL PROTECTED] |
| University of California, Davis (530)754-9127 |
| Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| The end to politics as usual: |
| The Monster Raving Loony Party (http://www.omrlp.com/) |
+------------------------------------------------------------------------+
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php