You are viewing limited content. For full access, please sign in.



for each custom sql not working if more than one value specified

asked on December 7, 2017 Show version history


I have case where I have a multi-valued field that contains integer values stored as nvarchar data type.  I am in a FOR EACH loop, and it contains a Custom SQL Query.  Now if I pass in a single value in single quotes to the SQL below, it works.  But if I pass in multiple values in single quotes, no rows are affected.

My SQL looks like this:

IF (@Status IN ('E' , 'R'))

      SELECT * FROM [Custom_LF_Data].[dbo].[AS400MAUQuotes]
      WHERE CAST([QuoteNumber] AS varchar) IN (@QuoteNr) AND [Status] <> 'A'

How would I get my @QuoteNr, which is defined as %(MultiQuoteNumber#[, ]#), to work if I have more than one value in my multi-valued field?



0 0


replied on December 7, 2017 Show version history

Could you not use a for each value and set it to the multi value token?

0 0
replied on December 7, 2017

I'm guessing you're looping over something other than the quote number? Otherwise you'd be running the same query over and over.

The query is parametrized so you can't inject a list with a single token. This is by design, for security purposes.

This post discusses a possible workaround and its pitfalls.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.