snippetsqlMinor
How to test if a column definition allows nulls?
Viewed 0 times
definitionallowscolumntesthownulls
Problem
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?
Solution
Never mind - found the answer over here
SELECT COLUMNPROPERTY( OBJECT_ID('dbo.spt_values'),'number','AllowsNull')Code Snippets
SELECT COLUMNPROPERTY( OBJECT_ID('dbo.spt_values'),'number','AllowsNull')Context
StackExchange Database Administrators Q#6197, answer score: 4
Revisions (0)
No revisions yet.