Solved

Alter Table Statements

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

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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