title: Retrieving table schema information using C#
body: <p>I want to retrieve the table schema information using C#. </p>
  
  <p>I used the <code>sp_help &lt;table_name&gt;</code> query to retrieve it, which works well when I execute it in query window but fail to retrieve it from C#. I want to retrieve all table information which is necessary for mapping between two tables such as name, datatype, size, isprimary, key, etc.</p>
  
  <p>I had write down following code </p>
  
  <pre><code>SqlCommand cmd = sourceCon.CreateCommand();
  cmd.CommandText = string.Format("sp_help '{0}'", cmbSourceTable.SelectedItem.ToString()); //cmd.CommandType = CommandType.StoredProcedure; 
  sourceDataTable = new DataTable(); 
  SqlDataReader dr = cmd.ExecuteReader(); 
  sourceDataTable.Load(dr);
  dr.Close(); 
  </code></pre>
  
  <p>It will returns only info about table that when it is created or not</p>