Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

primary keys

Status
Not open for further replies.

dky1e

Programmer
May 4, 2002
293
US
Hi,

I need to get information on which fields on a table are primary keys, using sql script. Which system tables/information schema views should I look into?

Thanks.
 
with :

sp_primarykeys

or u can get information from sysobjects

select * from sysobjects where xtype = 'PK'

Regards.
 
Thanks,

Can I get to it using the information_schema views?
 
I got it.
INFORMATION_SCHEMA.TABLE_CONSTRAINTS

sweet!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top