Hi everybody.
I'll really appreciate if somebody could help me with the following.
I have a multivalued parameter @.ProductType. Can be A1, U1 and T1.
Then, based on the value of this parameter, I populate another
cascading parameter. The query for the dataset is
CREATE TABLE #temp_cust (value varchar(10), name varchar(20))
IF @.ProductType LIKE '%A1%'
BEGIN
INSERT #temp_cust VALUES ('NAARC', 'Owner')
INSERT #temp_cust VALUES ('PANA', 'Annuitant')
INSERT #temp_cust VALUES ('COANN', 'Co-annuitant')
INSERT #temp_cust VALUES ('CONER', 'Co-owner')
INSERT #temp_cust VALUES ('PAYOR', 'Payor')
END
IF @.ProductType LIKE '%U1%' OR @.ProductType LIKE '%T1%'
BEGIN
IF NOT EXISTS (SELECT * from #temp_cust where name = 'Owner')
BEGIN
INSERT #temp_cust VALUES ('NAARC', 'Owner')
END
INSERT #temp_cust VALUES ('PRINI ', 'Primary Insured')
INSERT #temp_cust VALUES ('ADDNI', 'Additional Insured')
INSERT #temp_cust VALUES ('CHINI', 'Child Insured')
INSERT #temp_cust VALUES ('PAYNI', 'Payor')
END
SELECT * FROM #temp_cust
drop table #temp_cust
Everything works fine if when run the report I choose only one value,
say A1 or U1.
However, whenever I choose 2 of them the query for the dataset fails
with "Incorrect syntax near ',' "
Does anybody have any idea why?
Thank you so muchWhen you use a multivalue parameter, your query should look like this:
select * from CUSTOMERS
where COUNTRY in (@.paramCountry)
--
Thank you,
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.com
<sytnikk@.gmail.com> wrote in message
news:1f882336-1a0b-4f70-86d5-5302f1634d49@.l16g2000hsf.googlegroups.com...
> Hi everybody.
> I'll really appreciate if somebody could help me with the following.
> I have a multivalued parameter @.ProductType. Can be A1, U1 and T1.
> Then, based on the value of this parameter, I populate another
> cascading parameter. The query for the dataset is
> CREATE TABLE #temp_cust (value varchar(10), name varchar(20))
> IF @.ProductType LIKE '%A1%'
> BEGIN
> INSERT #temp_cust VALUES ('NAARC', 'Owner')
> INSERT #temp_cust VALUES ('PANA', 'Annuitant')
> INSERT #temp_cust VALUES ('COANN', 'Co-annuitant')
> INSERT #temp_cust VALUES ('CONER', 'Co-owner')
> INSERT #temp_cust VALUES ('PAYOR', 'Payor')
> END
>
> IF @.ProductType LIKE '%U1%' OR @.ProductType LIKE '%T1%'
> BEGIN
> IF NOT EXISTS (SELECT * from #temp_cust where name = 'Owner')
> BEGIN
> INSERT #temp_cust VALUES ('NAARC', 'Owner')
> END
> INSERT #temp_cust VALUES ('PRINI ', 'Primary Insured')
> INSERT #temp_cust VALUES ('ADDNI', 'Additional Insured')
> INSERT #temp_cust VALUES ('CHINI', 'Child Insured')
> INSERT #temp_cust VALUES ('PAYNI', 'Payor')
> END
> SELECT * FROM #temp_cust
> drop table #temp_cust
> Everything works fine if when run the report I choose only one value,
> say A1 or U1.
> However, whenever I choose 2 of them the query for the dataset fails
> with "Incorrect syntax near ',' "
> Does anybody have any idea why?
> Thank you so much
>
>|||Thanks a lot!
I wrote
IF 'A1' in (@.ProductType)
it works now!
Sunday, March 11, 2012
cascading multivalued parameters
Labels:
appreciate,
cascading,
database,
everybody,
following,
microsoft,
multivalued,
mysql,
oracle,
parameter,
parameters,
producttype,
server,
somebody,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment