title: Alternate nodes in a SQL Server XQuery path?
body: <p>Is there any way to have a sort of &quot;alternates group&quot; like in Regular Expressions, in an XQuery path in SQL Server?</p>
  <p>I have this query...</p>
  <pre><code>SELECT Q.ROWID QUEUEID, Q.DOCUMENTPACKAGETYPE, 
      B.R.value('@_ID', 'NAME') PARTYID,
      B.R.value('@_BorrowerID', 'NAME') BORROWERID,
      B.R.value('@_Name', 'NAME') NAME,
      B.R.value('@_EmailAddress', 'NAME') EMAILADDRESS
  FROM docutech.QUEUE_EX Q 
  CROSS APPLY Q.DATA.nodes('LOAN_PUSHBACK_PACKAGE/EVENT_DATA/ESIGN/PARTY') AS B(R)
  WHERE Q.REASONFORPUSHBACK = 'DocumentDistribution' AND B.R.value('@_Type', 'NAME') = 'Borrower'
  </code></pre>
  <p>But what I need, is for the <code>CROSS APPLY</code> the ESIGN node in the path can actually be either ESIGN or ECLOSE. So I am looking to do something like the following (thinking in RegEx terms)...</p>
  <pre><code>CROSS APPLY Q.DATA.nodes('LOAN_PUSHBACK_PACKAGE/EVENT_DATA/(ESIGN)|(ECLOSE)/PARTY') AS B(R)
  </code></pre>
  <p>Is there any way to do something like this? I'd really hate to have to repeat the same query twice, just for that simple difference, though maybe <code>XQuery</code> doesn't support options like that?</p>
  <p>Actually, I just found I <strong>can</strong> use an asterisk, which will match both, but I'd LIKE to be able to limit it to those known node values if possible. If not, I guess that will do.</p>