How to find a table with a primary key with a certain column name in Microsoft SQL?
<p>In Microsoft SQL, if I want to get information about where a column with a certain column name appears in my database, I can run this query:</p>

<pre><code>select * from information_schema.columns where column_name = 'XXXXX';
</code></pre>

<p>This query returns a wealth of information about the instances where a column with the name appears, but I don't see anything about referential constraints.</p>

<p>I've tried some other queries below, but none seem to yield the information I want:</p>

<pre><code>select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
select * from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
</code></pre>

<p>I want to write a query that would do something like this:</p>

<pre><code>select table_schema, table_name from INFORMATION_SCHEMA.COLUMNS
where column_name = 'XXXXX' and IsPrimaryKey = 1;
</code></pre>

<p><b>Edit:</b> It was suggested that this question duplicates a question about finding the primary key of a given table.  This question is related, but different because I am starting out knowing the name of a column (which may occur in many tables) and I want to be able to tell if there is a table with a primary key column with the same name.</p>