Altering a table

SQL Server 2012 allows existing tables to be modified in several ways. By using the ALTER TABLE command, you can make the following types of changes to an existing table.

  • Change the data type or the NULL property of a single column.

  • Add one or more new columns, with or without defining constraints for those columns.

  • Add one or more constraints.

  • Drop one or more constraints.

  • Drop one or more columns.

  • Enable or disable one or more constraints (applies only to CHECK and FOREIGN KEY constraints).

  • Enable or disable one or more triggers.

  • Rebuild a table or a partition to change the compression settings or remove fragmentation. (Fragmentation is discussed in Chapter 7; Chapter 8 discusses compression.)

  • Change the lock escalation behavior of a ...

Get Microsoft SQL Server 2012 Internals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.