This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to know Identity columns of a table?

 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information. I am planning to use the below query to fetch the result:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic