Previously i wrote an article with a method that how can we include not null column in a table already having data.
But that method has number of scripts to execute. SQL Server handle it in a very good way.
If you execute the script
ALTER TABLE TestTable
ADD ThirdCol INT NOT NULL DEFAULT(0)
GO
Then SQL Server will itself insert the default value 0 for the rows which are already present in database.
No comments:
Post a Comment