Posted By:
neal_ravindran
Posted On:
Tuesday, June 1, 2004 12:36 PM
Did not find any DatabaseMetaData APIs but, I found these on search of the web:-
select o.name + '.' + c.name
from syscolumns c, sysobjects o
where c.status & 128 = 128
and o.id = c.id
order by o.name
select table_name + '.' + column_name, table_name,
column_name, ordinal_position, data_type
from information_schema.columns
where
table_schema = 'dbo'
and columnproperty(object_id(table_name),
column_name,'IsIdentity') = 1
order by table_name
select TABLE_NAME + '.' + COLUMN_NAME, TABLE_NAME
from INFORMATION_SCHEMA.COLUMNS
where TABLE_SCHEMA = 'dbo'
and COLUMNPROPERTY(object_id(TABLE_NAME),
COLUMN_NAME, 'IsIdentity') = 1
order by TABLE_NAME
I think these queries work only for MS SQLServer
Also this article 313130 from MS