Solved

Alter Table Statements

Posted on 2011-03-23
2
321 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Creating and Managing Databases with phpMyAdmin in cPanel.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 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

14 Experts available now in Live!

Get 1:1 Help Now