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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -