Could any one help me to perform below task.
How can i make not allow column to allow null and Allow Null column to not allow null.
Use ALTER TABLE table_name ALTER COLUMN column_name datatype [NOT] NULL
Example:
CREATE TABLE #Foo
(
X INT NULL,
Y INT NOT NULL
)
/*This is metadata only change and very quick*/
ALTER TABLE #Foo ALTER COLUMN Y INT NULL
/*This requires all rows to be scanned to validate the data*/
ALTER TABLE #Foo ALTER COLUMN X INT NOT NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With