정보 도우미

테이블 속성 검색 본문

IT

테이블 속성 검색

정보도우미3 2015. 11. 29. 15:23

select a.name tabname, b.colid, b.name colname,
c.name + case when c.xprec = 0 then '('+ rtrim(convert(char, b.length))+')'
else '('+ rtrim(convert(char, b.xprec)) + ',' + rtrim(convert( char, b.xscale)) + ')'
end datatype,
case when b.isnullable = 0 then 'N'
else 'Y' end isnullable,
d.keyno pkorder
from sysobjects a
inner join syscolumns b
on (a.id = b.id)
inner join systypes c
on (b.xusertype = c.xusertype)
left outer join dbo.sysindexkeys d
on (b.id =d.id and b.colid = d.colid and indid =1)
where a.xtype = 'U'
and b.name = 'bunban'
order by a.id, b.colid

Comments