sql - alternatives to using IN clause -


i running below query:

select      receiptvoucherid,      voucherid,      receiptid,     rvtransactionamount,      amountused,      transactiontypeid      [scratch].[dbo].[loyaltyvouchertransactiondetails]            voucherid in      (2000723,     2000738,     2000774,     2000873,     2000888,     2000924,     2001023,     2001038,     2001074,     2001173) 

the aim being extract receiptvoucherid / voucherid / receiptid / rvtransactionamount / amountused / transactiontypeid data list of voucherid's have.

my problem here list of voucherid's 187k long in clause not possible returns error:

internal error: expression services limit has been reached

can advise on alternative doing way?

i using ssms 2014

just create table containing vouchers (hopefully have one) , use in() selecting table :

select      receiptvoucherid,      voucherid,      receiptid,     rvtransactionamount,      amountused,      transactiontypeid      [scratch].[dbo].[loyaltyvouchertransactiondetails]            voucherid in (select voucherid vourcherstable) 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -