Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

More than 1000 parameters in an SQL IN (VBA)

$
0
0

I'm making an oracle query from vba and ran into the limitation that there can't be more than 1000 entries in a SQL IN statement.

   LRow_Last_Product = Workbooks("test.xlsm").Worksheets("Check").Range("A" & Rows.Count).End(xlUp).Row    For Each RngZelle In Workbooks("test.xlsm").Worksheets("Check").Range("A7:A" & LRow_Last_Product)        If StrISINs = "" Then            StrISINs = "'" & RngZelle.Value & "'"        Else            StrISINs = StrISINs & ", '" & RngZelle.Value & "'"        End If    Next RngZelle'WHEREStrSQL = StrSQL & "t.externref IN (" & StrISINs & ")"

I was thinking about creating a function that would generate a second IN with an OR if there are more than 1000 parameters. What is the most efficient way to solve this?

Thanks


Viewing all articles
Browse latest Browse all 11661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>