|
|
Question : Add column to existing table, populate with default value
|
|
Curious how to accomplish/correct syntax for the following in T-SQL...
Database Name: TestDB Existing table name: MyTable Existing Column Names: ID, NameFirst, NameLast, MyDate
Want to add Column: "AvailabilityStat" With Default Value= "1" SQLType= "INT" (the value of this column will either be 1 or 2, so I'm assuming "INT" length will be 1.)
What would be the best/most efficient way to go about this? ~trail
|
Answer : Add column to existing table, populate with default value
|
|
alter tabel MyTable add AvailabilityState Int NOT NULL default (1)
|
|
|
|
|