Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Modify Column Type And Size

Author  Topic 

aoriju
Posting Yak Master

156 Posts

Posted - 2009-05-15 : 05:47:00
I want to modify an fieldName like
Chargeable_Food_Percentage ->INT -> into Numeric(6,2) using theQuery without Affecting the old values
Table Name-> FKMS_CTRL_Flight_Cancellation

malaytech2008
Yak Posting Veteran

95 Posts

Posted - 2009-05-15 : 06:07:36
You can change when this column does not have any values.

alter table table_name alter column colunm_name datatype

Malay
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-05-15 : 11:20:54
Depending on the size of your table you can add a new column, copy over the existing data,drop the old column and then rename the new column as needed. Or you can create a whole new table, copy over the data, drop the existing table and rename the new table.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-15 : 12:46:17
you can alter it using alter table tablename alter column... statement
Go to Top of Page
   

- Advertisement -