Link to home
Start Free TrialLog in
Avatar of private99
private99

asked on

Change field length or type in a database

If I has a table with a field
   1) length = 10
   2) type = int
the table contains some data.
Now, I decide to change the field
   1) length = 20
   2) type = varchar

Can I change the field length/type without lossing my data inside the table ?
Assume I use Oracle or MsSQL databse.
Avatar of arbert
arbert

Not sure how oracle handles it, but SQL Server will automatically conver the data-types if you issue an ALTER TABLE statement or change the structure through EM manager.

You should be ok since you are increasing the size of a field and converting a number to a string.  You would probably have more problems if you were decreasing the size of a field or converting a string to a number.

Brett
ASKER CERTIFIED SOLUTION
Avatar of Danielzt
Danielzt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
for oracle

alter table <tablename> modify <coloumn name> varchar2(20);