0

I want to use more than 1000 value with IN Clause that is not supported by this clause. eg.

select prodCode from Products where prodId IN (1,2,3.....,1020);

Can someone suggest me for any alternate solution??

Priya Prajapati
  • 304
  • 1
  • 4
  • 10

1 Answers1

1

Where did the values for prodId that you are putting into your IN clause originate from?

If they originated from another query, then you should combine the two queries.

If they originated from some complicated process or an external data source, then you should store them in a temporary table. The temporary table can just contain a prodId column. Join to that table instead of using an IN list.

WW.
  • 23,793
  • 13
  • 94
  • 121
  • yes prodId I am getting from different query of different table. – Priya Prajapati Jun 19 '13 at 11:59
  • @PriyaPrajapati In that case, replace the list in brackets with a SELECT that returns the list from the other table. Or re-write as a join to that table. – WW. Jun 20 '13 at 03:48