Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Unanswered: Change data type


    Is there a way to change the length of a varchar's column ?

    For example 15 to 25 ?

    Pablo Velasquez Rivas
    Computer Science Engineer - ITCR

  2. #2
    Join Date
    Aug 2003
    I think the only way of doing that is to create a temp table with the same structure except for the change to your varchar field, copy data from your original table to your temp table, delete the original table, and finally rename the tmp table to the name that your original table had:

    create table one (id int, name varchar(15));
    insert into one values (1, 'one');
    create table tmp (id int, name varchar(25));
    insert into tmp select * from one;
    drop table one;
    alter table tmp rename to one;

Posting Permissions

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