wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to know Identity columns of a table? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to know Identity columns of a table?" Watch "How to know Identity columns of a table?" New topic
Author

How to know Identity columns of a table?

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Hi

I have a requirement wherein I need to list the labels of identity (auto generated) columns of a table. I am using MS-SQL server and JDBC. Could you please tell, how to do this?

TIA


Thanks and Regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can interrogate the database meta data (see the java.sql package for a suitable class to do this). Or you can use the database's own catalog stored procedures and views. Depending on which versio nyou are on, you should get all you need from sys.objects or sys.columns.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Thanks for the information. I am planning to use the below query to fetch the result:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to know Identity columns of a table?