Presents your SQL SERVER E-NEWSLETTER for April 8, 2003 <-------------------------------------------> USE COLUMNPROPERTY TO DETERMINE COLUMN CHARACTERISTICS COLUMNPROPERTY is a statement that can help you determine the characteristics of a particular column in a table. It looks like this: COLUMNPROPERTY (id, column, property) The arguments include the ID for the identifier of the table or procedure, the column name, and the property being queried. If a property is true, COLUMNPROPERTY returns an integer of one. If the property returns false, COLUMNPROPERTY returns an integer of zero. If the input is invalid, COLUMNPROPERTY returns NULL. Properties can include: * AllowsNull * IsComputed * IsFulltextIndexed * IsIdentity * IsIndexable In the following example, we'll use the pubs database to check if the address column allows nulls: Use Pubs SELECT COLUMNPROPERTY ( OBJECT_ID('authors'), 'address', 'AllowsNull') Since the address column does allow nulls, COLUMNPROPERTY returns a one. Now we'll check the au_id column to determine if it allows nulls: Use Pubs SELECT COLUMNPROPERTY ( OBJECT_ID('authors'), 'au_id', 'AllowsNull') Because au_id is set as the primary key column on this table, it does not allow nulls and therefore returns an integer of zero. ----------------------------------------