select object_name(c.id) objname, c.colid colid, c.name colname, (case (c.status & 12 when 0 then t2.name else 'identity' end) coltype,
c.length collen, (case (c.status &when 0 then 'not null' else 'null' end) allownull
from syscolumns c, systypes t1, systypes t2
where c.id = object_id('CODEFIELD')
and c.usertype = t1.usertype and t1.type = t2.type
and t2.usertype = (select min(m.usertype) from dbo.systypes m where t2.type = m.type)
order by 1, 2 |