DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: data type conversion

  1. #1
    Join Date
    Mar 2008
    Posts
    140

    data type conversion

    Hi, a table in production server has a column with data type of number. But now the developers want it to change to varchar. My question is the table has data, how to convert its data type of the column when it already contains data of number data type.


    thanks,
    Last edited by iris; 08-23-2010 at 03:48 PM.

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    I would...
    1- Take an export of the affected table -as a backup
    2- Create a new varchar2() column as needed.
    3- Update new varchar2() column from old number column
    4- Check everything is okay with data in new varchar2() column
    5- Drop old number column
    6- Rename new varchar2() column to the name old number column used to have.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width