I need to query a SQL table and pull rows if the value in column NDC_CODE is among my list of values.

The problem is that my list is in the thousands and I'm not sure how best to code this.

I know I can excel-fu/concatenate/copy-paste a 'where' statement together: where RX_NDC.NDC_CODE in (‘ndc1',’ndc2’,'ndc3',…,’ndc8523’)

My questions are:

  1. if I run the code with the where statement as above, manually listing out thousands of values, will use a lot of resources and brick the server?
  2. Is it possible to create a "subset" locally that I can reference in the code instead and have this subset persist across multiple queries?
  3. I read about creating temporary tables, but I only have read-only access to this database. Is there some way to create a temporary table locally and reference this in my query?
0

There are 0 answers