dcsimg
Using DatabaseMetaData APIs how can I find if a primary key has the "identity seed" set?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   neal_ravindran
Posted On:   Wednesday, May 26, 2004 12:03 PM

Using DatabaseMetaData how can I find if a primary key has the "Identity seed" set? (In SQLServer it is called "Identity seed"..Now, is that "sequence number in Oracle???) . Please give example code if possible.


FYI, I use the MS SQLServer 2000 free jdbc driver(and hope and pray MS has implemented the API for this particular functionality...whatever that API call is I have no clue:)

Re: Using DatabaseMetaData APIs how can I find if a primary key has the "identity seed" set?

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

About | Sitemap | Contact