title: SQL statement to print table names and their column names
body: <pre><code>SELECT TABLE_NAME 
  FROM INFORMATION_SCHEMA.TABLES 
  WHERE TABLE_TYPE = 'BASE TABLE' 
  ORDER BY TABLE_NAME ASC
  </code></pre>
  
  <p>I am using this code to print the table names of a db.  What I want to do is print the table name and the col names in each table.  Can I do this by nesting a statement.</p>
  
  <p>This code is being run on a SQL Server in a query window.</p>
  
  <p>I tried this </p>
  
  <pre><code>SELECT COL_NAME 
  FROM 
      (SELECT TABLE_NAME 
       FROM INFORMATION_SCHEMA.TABLES 
       WHERE TABLE_TYPE = 'BASE TABLE' 
       ORDER BY TABLE_NAME ASC)
  </code></pre>
  
  <p>Any ideas?</p>