sql server - SQL : Test if a column has the "Not Null" property -
is there simple query return whether specific column allows nulls?
want change part of db upgrade script.
alternatively, better change it, if set?
edit : sql server (needs support 2000 or later)
any particular rdbms?
in sql server
use master select columnproperty( object_id('dbo.spt_values'),'number','allowsnull')
or (more standard)
select is_nullable information_schema.columns table_schema='dbo' , table_name='spt_values' , column_name='number'
Comments
Post a Comment