title: SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints
body: <p>I need to write a query on SQL server to get the list of columns in a particular table, its associated data types (with length) and if they are not null. And I have managed to do this much. </p>
  
  <p>But now i also need to get, in the same table, against a column - <code>TRUE</code> if that column is a primary key. </p>
  
  <p>How do i do this? </p>
  
  <p>My expected output is:</p>
  
  <pre><code>Column name | Data type | Length | isnull | Pk
  </code></pre>