I am looking for query that I can use to add ten new boolean columns to existing table without effecting anything else in database. Also by default these boolean columns should be set to true as default.
Looking for best practices.
Edit
“Also by default these boolean columns should be set to true as default.”
Sorry I meant to say that for records already exists new column should have value set as true, there shouldn’t be any default value as I will set it myself.
just add the columns via an ALTER statement:
or not nullable with a default value:
thats it for MSSQL.
EDIT:
if you want to add multiple columns at a time you can use:
the “go” completes the batch.