title: how to set powershell variables from multiple column in sql query
body: <p>I have the following query that I run in powershell:</p>
  
  <pre><code>$Query = "SELECT 
               t1.BSM_NM
              ,t1.D_DTM AS MAXDATETIME
              ,CASE
                  WHEN SUM(t1.V_CUST_BLK_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.MAJOR_VOICE_BLOCK) AND SUM(t1.V_CUST_BLK_CNT)/SUM(t1.V_ATT_CNT) &lt; MAX(t2.CRITICAL_VOICE_BLOCK)
                       OR
                       SUM(t1.V_DRP_CALL_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.MAJOR_VOICE_DROP) AND SUM(t1.V_DRP_CALL_CNT)/SUM(t1.V_ATT_CNT) &lt; MAX(t2.CRITICAL_VOICE_DROP)
                       OR
                       SUM(t1.V_AXS_F_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.MAJOR_VOICE_AXSFAIL) AND SUM(t1.V_AXS_F_CNT)/SUM(t1.V_ATT_CNT) &lt; MAX(t2.CRITICAL_VOICE_AXSFAIL)
                  THEN 1
                  WHEN SUM(t1.V_CUST_BLK_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.CRITICAL_VOICE_BLOCK)
                       OR
                       SUM(t1.V_DRP_CALL_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.CRITICAL_VOICE_DROP)
                       OR
                       SUM(t1.V_AXS_F_CNT)/SUM(t1.V_ATT_CNT) &gt;= MAX(t2.CRITICAL_VOICE_AXSFAIL)
                  THEN 2
                  ELSE 0
               END MAJORCRITICAL
              FROM DMSN.DS3R_FH_1XRTT_BTS_LVL_KPI t1
              INNER JOIN
              ZDMSN.DS3R_1XRTT_TRIGGERS_THRESHOLD t2
              ON
              t1.BSM_NM = t2.BSC_NM
              WHERE t1.BSM_NM = 'ARL1' and t1.D_DTM = (SELECT MAX(D_DTM) FROM DS3R_FH_1XRTT_BTS_LVL_KPI WHERE BSM_NM = 'ARL1')
              GROUP BY
              t1.BSM_NM, t1.D_DTM"      
  
  $data_set = new-object system.data.dataset
  $adapter = new-object system.data.oracleclient.oracledataadapter ($Query, $Connection)
  [void] $adapter.Fill($data_set)
  $table = new-object system.data.datatable
  $table = $data_set.Tables[0]   
  </code></pre>
  
  <p>but how would I set BSM_NM, MAXDATETIME, and MAJORCRITICAL as variables in powershell. I want to eventually use them in a email further down the script.</p>