title: Generate XML-formatted table schema from SQL Server 2005?
body: <p>I was wondering how I might take a table schema in SQL Server and generate an XML document from it.  The ideal would be if I passed in my database name (“SalesOrders”) and an XML doc comes back reading something like:</p>
  
  <pre><code>&lt;table=”SalesOrders”&gt;
  &lt;columns&gt;
      &lt;name=”SalesOrderID”/&gt;
          &lt;datatype=”int”/&gt;
          &lt;allowNulls=”false”/&gt;
      &lt;/name&gt;
      &lt;name=”DateOfSale”&gt;
          &lt;datatype=”DateTime”/&gt;
          &lt;allowNulls=”false”/&gt;
      &lt;/name&gt;
  &lt;/columns&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>You get the idea.  Something along these lines, an XSD schema would be fine too.  In the back of my head I think SQL Server has mechanisms for doing this but I'm not positive.  Many thanks for your suggestions.</p>