i want to find the primary key from my vb application
so the sql st will be helpful
Main Topics
Browse All TopicsI want a sql st which will take the table name as input and give me the colname of primarykey of that table.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
i have written a sql is it correct
select colname from syscolumns where tabid=(
select tabid from systables where tabname='testice')
and colno= (select
part1 from sysindexes where tabid =(
select tabid from systables where tabname='testice')
and idxname=(
select idxname from sysconstraints where tabid=(
select tabid from systables where tabname='testice') and constrtype='P'))
v_iyengar:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Business Accounts
Answer for Membership
by: bripatPosted on 2002-11-12 at 09:22:27ID: 7439097
You can query the system tables for all information about anything in the database. I don’t have access to a database right now, so I can’t tell you exactly where to look. I think you can figure it out just by using dbaccess to look at the column names in each of the system tables.