title: alternatives to using IN clause
body: <p>I am running the below query:</p>
  
  <pre><code>SELECT 
      ReceiptVoucherId, 
      VoucherId, 
      ReceiptId,
      rvtransactionAmount, 
      AmountUsed, 
      TransactionTypeId
  FROM 
      [Scratch].[dbo].[LoyaltyVoucherTransactionDetails]
  WHERE       
      VoucherId IN 
      (2000723,
      2000738,
      2000774,
      2000873,
      2000888,
      2000924,
      2001023,
      2001038,
      2001074,
      2001173)
  </code></pre>
  
  <p>the aim being to extract the ReceiptVoucherId / VoucherId / ReceiptId /  rvtransactionAmount / AmountUsed / TransactionTypeId data for the list of voucherId's that I have.</p>
  
  <p>My problem here is that my list of VoucherID's is 187k long so an IN clause is not possible as it returns the error:</p>
  
  <p><em>Internal error: An expression services limit has been reached</em></p>
  
  <p>Can anyone advise on a alternative to doing it this way?</p>
  
  <p>I am using SSMS 2014</p>