Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
srivatsahg
Yak Posting Veteran
71 Posts |
Posted - 2009-08-11 : 04:22:28
|
Hello I have a huge table (approx 4,000,000 records)Now i want to add a new column to this table.I get query timeout if i use it from the UI wizard.Any suggestions of adding a new column to this table..Srivatsa |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-11 : 04:35:52
|
Do it in a query window.ALTER TABLE Table1 ADD MyNewCol INT NOT NULL DEFAULT (0) N 56°04'39.26"E 12°55'05.63" |
 |
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2009-08-11 : 08:01:20
|
Add column at the end of columns list, don't change the position of any existing column or newly added one. Putting new one at the end never push it to copy records into temp table and then back to original one. |
 |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2009-08-12 : 19:30:42
|
There is a potential gotcha associated with adding a column to a table. If there is any code that makes use of implicit column names, then there is a possibility of breaking your existing code. For example: INSERT INTO TableWith4Columns SELECT * -- note the implicit column usage FROM TableModifiedToHave5ColumnsWith the new fifth column added, this code will break. This is a great reason why you don't want to use this type of coding and instead explicitly list out the columns being used.=======================================Men build too many walls and not enough bridges. -Isaac Newton, philosopher and mathematician (1642-1727) |
 |
|
|
|
|