<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Find Primary Key Using SQL Server Management Studio</title>
	<atom:link href="http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 10 Feb 2012 02:12:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Manjunath C Bhat</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-174951</link>
		<dc:creator><![CDATA[Manjunath C Bhat]]></dc:creator>
		<pubDate>Tue, 04 Oct 2011 09:25:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-174951</guid>
		<description><![CDATA[This might be useful as well.

SELECT SS.NAME AS [TABLE_SCHEMA], ST.NAME AS [TABLE_NAME]
     , SKC.NAME AS [CONSTRAINT_NAME], SC.NAME AS [CONSTRAINT_COLUMN_NAME], 
     CAST(STY.NAME AS VARCHAR(20)) +&#039;(&#039;+
     CAST(CASE ST.NAME 
     WHEN &#039;NVARCHAR&#039; THEN (SELECT SC.MAX_LENGTH/2)
     ELSE (SELECT SC.MAX_LENGTH)
     END AS VARCHAR(20)) +&#039;)&#039; AS [DATA_TYPE]
  FROM SYS.KEY_CONSTRAINTS AS SKC
  INNER JOIN SYS.TABLES AS ST
    ON ST.OBJECT_ID = SKC.PARENT_OBJECT_ID
  INNER JOIN SYS.SCHEMAS AS SS
    ON SS.SCHEMA_ID = ST.SCHEMA_ID
  INNER JOIN SYS.INDEX_COLUMNS AS SIC
    ON SIC.OBJECT_ID = ST.OBJECT_ID
   AND SIC.INDEX_ID = SKC.UNIQUE_INDEX_ID
  INNER JOIN SYS.COLUMNS AS SC
    ON SC.OBJECT_ID = ST.OBJECT_ID
   AND SC.COLUMN_ID = SIC.COLUMN_ID
  INNER JOIN SYS.TYPES AS STY
	ON SC.USER_TYPE_ID = STY.USER_TYPE_ID 
  ORDER BY TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_NAME;]]></description>
		<content:encoded><![CDATA[<p>This might be useful as well.</p>
<p>SELECT SS.NAME AS [TABLE_SCHEMA], ST.NAME AS [TABLE_NAME]<br />
     , SKC.NAME AS [CONSTRAINT_NAME], SC.NAME AS [CONSTRAINT_COLUMN_NAME],<br />
     CAST(STY.NAME AS VARCHAR(20)) +&#8217;(&#8216;+<br />
     CAST(CASE ST.NAME<br />
     WHEN &#8216;NVARCHAR&#8217; THEN (SELECT SC.MAX_LENGTH/2)<br />
     ELSE (SELECT SC.MAX_LENGTH)<br />
     END AS VARCHAR(20)) +&#8217;)&#8217; AS [DATA_TYPE]<br />
  FROM SYS.KEY_CONSTRAINTS AS SKC<br />
  INNER JOIN SYS.TABLES AS ST<br />
    ON ST.OBJECT_ID = SKC.PARENT_OBJECT_ID<br />
  INNER JOIN SYS.SCHEMAS AS SS<br />
    ON SS.SCHEMA_ID = ST.SCHEMA_ID<br />
  INNER JOIN SYS.INDEX_COLUMNS AS SIC<br />
    ON SIC.OBJECT_ID = ST.OBJECT_ID<br />
   AND SIC.INDEX_ID = SKC.UNIQUE_INDEX_ID<br />
  INNER JOIN SYS.COLUMNS AS SC<br />
    ON SC.OBJECT_ID = ST.OBJECT_ID<br />
   AND SC.COLUMN_ID = SIC.COLUMN_ID<br />
  INNER JOIN SYS.TYPES AS STY<br />
	ON SC.USER_TYPE_ID = STY.USER_TYPE_ID<br />
  ORDER BY TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_NAME;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivek</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-138401</link>
		<dc:creator><![CDATA[vivek]]></dc:creator>
		<pubDate>Thu, 02 Jun 2011 12:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-138401</guid>
		<description><![CDATA[how I can use join query to fetch the unique data from two or more than two table

if Table A has column a1,a2,a3,a4,a5

Table B has column a1,a2,a3,b1,b2

Table C has column a1,a2,a3,c1,c2

where a1 is primary key for each table

I want to use * since number of column may be any number 
in the other table so the value a1,a2,a3 get repeated for every table.how I can get only unique value in my query result a1,a2,a3 should not get repeated.......]]></description>
		<content:encoded><![CDATA[<p>how I can use join query to fetch the unique data from two or more than two table</p>
<p>if Table A has column a1,a2,a3,a4,a5</p>
<p>Table B has column a1,a2,a3,b1,b2</p>
<p>Table C has column a1,a2,a3,c1,c2</p>
<p>where a1 is primary key for each table</p>
<p>I want to use * since number of column may be any number<br />
in the other table so the value a1,a2,a3 get repeated for every table.how I can get only unique value in my query result a1,a2,a3 should not get repeated&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-138374</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 02 Jun 2011 09:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-138374</guid>
		<description><![CDATA[You need to open the table in design mode then right click on that column]]></description>
		<content:encoded><![CDATA[<p>You need to open the table in design mode then right click on that column</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sana</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-137720</link>
		<dc:creator><![CDATA[Sana]]></dc:creator>
		<pubDate>Tue, 31 May 2011 03:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-137720</guid>
		<description><![CDATA[I was trying to add primary key to existing table. When I right click after selecting the columns, &#039;set primary key&#039; option is not active. Do you know what&#039;s going on. I am a beginner using SQL server management studio.


Sana]]></description>
		<content:encoded><![CDATA[<p>I was trying to add primary key to existing table. When I right click after selecting the columns, &#8216;set primary key&#8217; option is not active. Do you know what&#8217;s going on. I am a beginner using SQL server management studio.</p>
<p>Sana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mermaid</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-101875</link>
		<dc:creator><![CDATA[mermaid]]></dc:creator>
		<pubDate>Wed, 24 Nov 2010 14:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-101875</guid>
		<description><![CDATA[Great thanks Pinal Dave!! Your writings are always very useful for me.
I want to ask, can we find the index columns of the primary key? Can somebody help me please...]]></description>
		<content:encoded><![CDATA[<p>Great thanks Pinal Dave!! Your writings are always very useful for me.<br />
I want to ask, can we find the index columns of the primary key? Can somebody help me please&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asem</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-65090</link>
		<dc:creator><![CDATA[Asem]]></dc:creator>
		<pubDate>Tue, 13 Apr 2010 10:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-65090</guid>
		<description><![CDATA[Please, if i want to make a column auto generated using SQL management studio 2005, how could i do that.

Thanks]]></description>
		<content:encoded><![CDATA[<p>Please, if i want to make a column auto generated using SQL management studio 2005, how could i do that.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A.Govindaraj</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-46013</link>
		<dc:creator><![CDATA[A.Govindaraj]]></dc:creator>
		<pubDate>Tue, 27 Jan 2009 05:31:29 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-46013</guid>
		<description><![CDATA[how I could add two primary key in sql 2005 ?

for example I have this table

ECE_Activities
—————=
Act_id int Not Null
Act_sec_id int Not Null
Act_name varchar
Act_min_balance

I want to “Act_id” and “Act_sec_id” to make both of them primary key.


same problem]]></description>
		<content:encoded><![CDATA[<p>how I could add two primary key in sql 2005 ?</p>
<p>for example I have this table</p>
<p>ECE_Activities<br />
—————=<br />
Act_id int Not Null<br />
Act_sec_id int Not Null<br />
Act_name varchar<br />
Act_min_balance</p>
<p>I want to “Act_id” and “Act_sec_id” to make both of them primary key.</p>
<p>same problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Abo Al-rob</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-45051</link>
		<dc:creator><![CDATA[Ali Abo Al-rob]]></dc:creator>
		<pubDate>Wed, 24 Dec 2008 06:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-45051</guid>
		<description><![CDATA[Dear Imran,


how I could add two primary key in sql 2005 ?

for example I have this table 

ECE_Activities
---------------=
Act_id  int     Not Null
Act_sec_id   int   Not Null
Act_name    varchar
Act_min_balance



I want to &quot;Act_id&quot;  and &quot;Act_sec_id&quot; to make both of them primary key.

thanks,
Ali Abo Al-rob]]></description>
		<content:encoded><![CDATA[<p>Dear Imran,</p>
<p>how I could add two primary key in sql 2005 ?</p>
<p>for example I have this table </p>
<p>ECE_Activities<br />
&#8212;&#8212;&#8212;&#8212;&#8212;=<br />
Act_id  int     Not Null<br />
Act_sec_id   int   Not Null<br />
Act_name    varchar<br />
Act_min_balance</p>
<p>I want to &#8220;Act_id&#8221;  and &#8220;Act_sec_id&#8221; to make both of them primary key.</p>
<p>thanks,<br />
Ali Abo Al-rob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Santu.IITBOMBAY</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-43113</link>
		<dc:creator><![CDATA[Santu.IITBOMBAY]]></dc:creator>
		<pubDate>Mon, 22 Sep 2008 13:14:45 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-43113</guid>
		<description><![CDATA[thanks for the great post man]]></description>
		<content:encoded><![CDATA[<p>thanks for the great post man</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2008/09/06/sql-server-find-primary-key-using-sql-server-management-studio/#comment-42461</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Sat, 06 Sep 2008 03:03:43 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=969#comment-42461</guid>
		<description><![CDATA[You have been a wonderful teacher. I call myself as Pinal Dave&#039;s  Student. 

What I do is not even comparable with what you have been doing to help SQL Community. Again Thanks for appreciating my work, I see many other people helping other members on this website, One among them whom I know ( through website) is &quot;Emeka&quot;

Excellent work Dear. 

Thanks,
Imran.]]></description>
		<content:encoded><![CDATA[<p>You have been a wonderful teacher. I call myself as Pinal Dave&#8217;s  Student. </p>
<p>What I do is not even comparable with what you have been doing to help SQL Community. Again Thanks for appreciating my work, I see many other people helping other members on this website, One among them whom I know ( through website) is &#8220;Emeka&#8221;</p>
<p>Excellent work Dear. </p>
<p>Thanks,<br />
Imran.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

