ALTER Table | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

ALTER Table

Hi, I have one question related to ALTER Table.I got some changes related to data type in my Table which contain some data also. I dont want to drop and create table because if i drop and recreate i will lose all my data. Is there is any way i can use ALTER TABLE to achieve above task. I have already workaround to dump the data into temporary table and after running drop/create i can dump the data back into main table. Thanks and Regards Ravi K

What is the chage that you are going to do
is it char to int or int to float what is it —————————————-
Cast your vote
http://www.geocities.com/dineshasanka/sqlserver05.html http://spaces.msn.com/members/dineshasanka

Can you be a bit more specific? As Dinesh mentioned, from what datatype into what datatype are you trying to alter? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

You can use ALTER TABLE… ALTER COLUMN to change the datatype, books online is your resource.
As referred above be clear about your requirement. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Are you talking about User defined datatype? Madhivanan Failing to plan is Planning to fail
Hi, Thanks for your reply.
I am changing from varchar data type to int data type.
If you can ensure that all existing data is convertible to int, there should be no problem at all. —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

If your varchar datatype has the value 12345678901234 then converting it to int will result in error Madhivanan Failing to plan is Planning to fail
]]>