Search This Blog

Alter column set default

CREATE TABLE dbo.tempabc
(
[col1] [varchar] (16),
[col2] [int] NULL CONSTRAINT df__tempabc__Col2 DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE dbo.tempabc ALTER COLUMN Col1 VARCHAR(32) NOT NULL
ALTER TABLE dbo.tempabc ADD CONSTRAINT df__tempabc__Col1 DEFAULT 'abc' FOR Col1
 

No comments: