I have to add a not null column in a table.
I am using
IF NOT EXISTS(SELECT * FROM information_schema.columns WHERE column_name = 'xyz'
AND table_name = 'abc')
BEGIN
ALTER TABLE abc WITH NOCHECK ADD xyz MONEY NOT NULL
END
It gives me error
ALTER TABLE only allows columns to be added that can contain nulls, or have a DEFAULT definition specified, or the column being added is an identity or timestamp column, or alternatively if none of the previous conditions are satisfied the table must be empty to allow addition of this column. Column 'xyz' cannot be added to non-empty table 'abc' because it does not satisfy these conditions.
can anybody have any idea, what's wrong with my SP?
?