SELECT sys.columns.name,
(SELECT name from sys.types where sys.types.system_type_id=sys.columns .system_type_id) as system_type_name,
sys.columns.max_length,
sys.columns.is_nullable ,
'is_pk'=
(select --c.id, c.name ,k.colid ,k.keyno
case when count(*)> 0 then 'true' else 'false' end
from sysindexes i
join sysindexkeys k on i.id = k.id and i.indid = k.indid
join sysobjects o on i.id = o.id
join syscolumns c on i.id=c.id and k.colid = c.colid
where o.xtype = 'U'
and exists(select 1 from sysobjects where xtype = 'PK' and name = i.name)
and c.name=sys.columns .name and c.id=sys.columns .object_id
)
from sys.tables ,sys.columns
where sys.tables.name='hr_SalaryRecords' and sys.tables.object_id =sys.columns .object_id