Compare Page Revisions
« Older Revision - Back to Page History - Newer Revision »
if object_id('DF_SchemaName_TableName_ColumnName') is not null alter table SchemaName.TableName drop constraint DF_SchemaName_TableName_ColumnName
if COL_LENGTH('TableName','ColumnName') is not null alter table dbo.TableName drop column ColumnName
alter table dbo.TableName ADD ColumnName int not null identity(1,1) ,ColumnName2 date not null ,ColumnName3 varchar(3) null constraint DF_TableName_ColumnName3 DEFAULT 'XYZ' WITH VALUES
COLUMN
ADD
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
ALTER TABLE MyTable ADD AddDate smalldatetime NOT NULL CONSTRAINT AddDateDflt DEFAULT getdate()
ALTER TABLE MyTable ADD AddDate smalldatetime NULL CONSTRAINT AddDateDflt DEFAULT getdate() WITH VALUES
ALTER TABLE doc_exb DROP COLUMN column_b
ALTER TABLE MyTable ALTER COLUMN NullCOl NVARCHAR(20) NOT NULL
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.