Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 24th, 2007, 12:01 AM
Registered User
Join Date: Jul 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL to identify the primary key in a table?


I have been looking for a way to identify the primary key defined in a
table using a Transact SQL Sentence in SQL Server...how can i do it?

Thanx for your support!!!

Diego Bayona

Old October 24th, 2007, 02:33 AM
Friend of Wrox
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts

I think it can be done by looking for Is_Identity = 1 in sys.columns...

--Jeff Moden

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i alter table (primary key + identity ) keyvanjan SQL Server 2000 1 July 12th, 2007 06:49 AM
Update Table with dataset without primary key ranakdinesh ASP.NET 2.0 Professional 1 September 28th, 2006 05:30 PM
Placing a Primary Key in Another Table When Adding DavidWE Access VBA 1 August 10th, 2006 12:46 PM
Get primary Key Columns From Access Table MeSaqi Access VBA 0 July 18th, 2003 08:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.