Sunday 27 September 2015

Adding a Column to a Table in SQL Server

Adding a Column to a Table in SQL Server

To add a new column to a table, follow this formula:
ALTER TABLE TableName
ADD ColumnName Properties

Here is an example:
ALTER TABLE StaffMembers
ADD Address varchar(100) NULL

When this code is executed, a new column named Address, of type varchar, with a limit of 100 characters, and that allows empty entries, would be added to the table named StaffMembers.

No comments:

Post a Comment