Solved

Alter Table Statements

Posted on 2011-03-23
2
314 Views
Last Modified: 2012-05-11
Hello Folks,

Is it possible to alter a table column , create a new column from the contents of an already existing Column..
e.g
ALTER TABLE `tb_name` ADD `new_column` VARCHAR( 250 ) FROM `tb_name` CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AFTER `old_column`  but i want all the contents from the old_column to be replicated to the new_column..

Thanks in advance
0
Comment
Question by:greeneel
2 Comments
 
LVL 11

Assisted Solution

by:JoeNuvo
JoeNuvo earned 200 total points
ID: 35196365
I don't think so.
You have to run update query after alter table.
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 300 total points
ID: 35196386

Youn need the aletr column to ad new column
andafter that you need to run update statement to move data to new column

Update `tb_name`
set `new_column`  = `old_column`
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now