Wednesday, May 05, 2010

SQL Server - Altering / Adding Columns

You can add new columns to an existing table. .

ALTER TABLE [dbo].[phone]
ADD inactive_date DATETIME NULL

GO

Alter column

You can add modify an existing column

ALTER TABLE [dbo].[person]
ALTER COLUMN [lastname] VARCHAR(35) NULL

GO

----------------------------------------------------------------------------

ALTER TABLE mytable
ALTER COLUMN mycolumn datatype(new_width)

No comments:

Post a Comment