I have a table with roughly 3000 rows in it and I need to modify a column definition to allow nulls. I have a change script that will perform the change but I would like to be able to re-run the script so that the change will only occur if the column definition hasn't already been changed. How do I test a column definition to identify if the column is NULL or NOT NULL?
You can also look at
select IS_NULLABLE from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='table' and COLUMN_NAME ='column'
Never mind - found the answer over here
SELECT COLUMNPROPERTY( OBJECT_ID('dbo.spt_values'),'number','AllowsNull')