Database Reference
In-Depth Information
Be aware that menus in Management Studio are context sensitive, meaning that the table designer window
will not be available unless the table designer is open. It also means that if there are no changes since the change
script was last run, this menu item is grayed out, because there are no changes recorded.
After you have saved your table, you can continue to work on it and save it again, or you can close the
designer window by clicking the small x on the table designer tab (Figure 5-21 ). Each time you save and make a
new change, a new script is created.
Changing an Existing Table
If you wish to work on an existing table you can reopen the table designer by right-clicking the table in Object
Explorer and selecting Design from the context menu. When the table designer opens, you can modify the table's
current columns, or add a column by clicking the blank row at the bottom of the column list. Alternately, you can
add a column by right-clicking existing columns and choosing the Insert Column option from the context menu.
In the table designer, changes to a table sometimes force it to be re-created behind the scenes.
When this happens, SQL Server Management Studio will do the following:
1.
Create a temporary table.
2.
Import data from an original table into the temporary table.
3.
Delete the original table.
4.
Rename the temporary table to the original table name.
This re-creation process could take a long time if the table had a lot of data. Because of this, Microsoft's
default setting does not allow for operations that force a table re-creation. You can, however, change the SQL
Server Management Studio options to allow this to occur. To do so, go to the Tools Options menu item. An
Options dialog window will open, as shown in Figure 5-23 . You need to navigate down to the Designers section in
the treeview of this dialog window and then expand the section before being able to see the Tables and Database
Designers page. Navigate to this page and look for the “Prevent saving changes that require table re-creation”
checkbox. Uncheck this box, and then click OK.
Figure 5-23. Allowing table re-creation in the designers page
 
Search WWH ::




Custom Search