79171181

Date: 2024-11-08 18:34:18
Score: 1
Natty:
Report link

Very simply, there is a major difference between alter and drop/create. Without getting into details this comes down to the way that database pages work at a structural level. Some changes (adding a column) can be done using alter as long as you understand that the new column will most likely end up on a different page from the rest of the table. Other changes (inserting a column) must drop and create so that the new column can be placed on the correct page to be in the correct order. Either way, Drop / Create is the best way to ensure that at that you don't end up with fragmentation at the page level. It's the cleanest and most efficient way to make table changes.

This also brings up a very important piece of advice: Script everything, test, test and retest before you roll anything to production!!

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: David Esquivel