October 23, 2003 at 12:51 pm
Hi, I have one question. If I want to add new field in between other existing fields, does SQL Server needs to rebuild the table?
For example:
Col1,
Col2,
Col3
I want to change the table's structure as:
Col1,
ColAA,
Col2,
Col3.
Thanks!
October 23, 2003 at 1:28 pm
Why? There is no real need for this!
However, you can open your table in design view in EM, insert an empty row at the desired place, define data type, save and you're done. Behind the scenes I think the table is dropped and rebuilt, so depending on how many rows are in the table it might take time and blow up you log file.
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
October 24, 2003 at 6:59 am
Dosen't referential integrity come into play here? If the table you are going to modify has foreign key constraints related to it, won't referential integrity prevent the table from being dropped before it can be rebuilt with the new column?
October 24, 2003 at 7:09 am
Try it out.
Works here without any issue. Even with having a relationship
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
October 24, 2003 at 8:37 am
A way to do this without reloading (which enterprise manager does behinds the scenes including constraints) is to add the column, use sp_rename on the table and then create a view with the original table name.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply