Suggestions on altering col. width on Live Database

  • Calling upon SQL Guru's for advice...

    We have a table in production with nearly 5 million records. I need to increase the width of 4 columns varchar(20) to varchar(50) (why so far down the line? 'coz of system integration).

    What is your recommendation?

    (1) ALTER COLUMN (I checked the SQL Syntax - I will have to issue 4 separate ALTER statements - or am I missing something? Can I combine it into a single ALTER statement?)

    (2) create a temp table with new structure, copy the data, drop old table and rename new table, re-create indexes)

    I am leaning towards option (1) since Option (2) appears more time consuming. None of the columns are indexed. I have 1 hour window where users will not be using the system but it is one of the most critical tables in our DB so want to minimize the risks of errors.

    Would like to test out both options in test environment (which I plan to do anyway) but as always time crunch.. So, any quick advice would be useful...

     

     

  • I believe you should be good with option 1 as you don't have any index and the field is also varchar()

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply