Tuesday, October 21, 2008

ADD a Column, Integer with a NOT NULL and a DEFAULT value

ALTER TABLE [CompCredSurvey].[2004Survey] ADD SurveyYear int not null default (2004)

I tried this without the brackets like the examples I found on the web, but SQL wouldn't accept it. Once I bracketed it worked fine. You might have to bracket the column name a well [SurveyYear].

No comments: