title: SQL loop for each column in a table
body: <p>Say I have a table called:</p>
  <pre><code>TableA
  </code></pre>
  <p>The following columns exist in the table are:</p>
  <pre><code>Column1, Column2, Column3 
  </code></pre>
  <p>what I am trying to accomplish is to see how many records are not null.</p>
  <p>to do this I have the following case statement:</p>
  <pre><code>sum(Case when Column1 is not null then 1 else 0 end)
  </code></pre>
  <p>What I want is the above case statement for every table that exists from a list provided and to be run for each columns that exists in the table.</p>
  <p>So for the above example the case statment will run for Column1, Column2 and Column3 as there are 3 columns in that particular table etc</p>
  <p>But I want to specfiy a list of tables to loop through executing the logic above</p>