top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can we alter a huge table in SQL

+4 votes
266 views

My table is too big and now i realize that i need to add few columns in that, but when i tried to do this, my alter script took more then 4 hours and database performance also got degraded, so i canceled the query, can anyone suggest better way of doing that

posted Feb 27, 2014 by Neeraj Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
 
Best answer

One way is you back up the table first then truncate it, then alter your table. after that insert data in it.

answer Mar 1, 2014 by Prachi Agarwal
Similar Questions
+1 vote

When writing a T-SQL script that I plan on re-running, often times I use temporary tables to store temporary data. Since the temp table is created on the fly, I'd like to be able to drop that table only if it exists (before I create it).

I'll post the method that I use, but I'd like to see if there is a better way.

...