Results 1 to 2 of 2

Thread: alter column

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Unanswered: alter column

    how to alter datatype of a column in all the tables of a database.The column is present all of the tables.i have to change its datatype.how to do this without manually changing individiual table.with some sort of script?
    thanks in advance

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    You can generate a script using SQL.

    Assuming you want to change the type to VARCHAR(10) for all tables
    Code:
    SELECT 'ALTER TABLE '||table_name||' MODIFY the_column VARCHAR(10);'
    FROM user_tables;
    This will generate the necessary statements to alter all tables of the current user.

Posting Permissions

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