When I create a report with a parameter in a join clause I get this error [Microsoft][ODBC SQL Server Driver] Invalid number of parameters
( [Microsoft][ODBC SQL Server Driver] Número de parámetros no váildo)
sample query in report
select distinct
iar.des1 as ArtNom, iar.des2, ars.fac_ent_sal, ars.fac_minimo, iar.contenido, iar.uds_cont,
ars.uds_sal, art.cant_vol0, art.cant_vol1, ltrim(rtrim(iar.cve_lar)) as ArtCveLar,
art.precio_vta0 + dbo.fn_FPGC(art.art, art.cant_pre0) as [Precio],
art.precio_vta1 + dbo.fn_FPGC(art.art, art.cant_pre1) as [Precio2],
art.cant_pre1, art.cant_pre0, art.precio_vta2 + dbo.fn_FPGC(art.art, art.cant_pre2) as [Precio3],
art.cant_pre3, art.art as Art, art.precio_vta0, iar.cve_lar
from inviar iar
join invart art on art.art = iar.art
join invars ars on ars.cia = art.cia and ars.alm=art.alm and ars.cve_art=art.art and ars.sub_alm =:SUBALM
where
art.cia =:CIA
and art.alm =:ALM
order by des1
The problem is with the SUBALM param, if I move it to the where section it the report works well
It should be a limitation of the driver, some drivers does not allow params in joins, select clauses, and none allow for example in order by clause. Use StringSubstitution parameter type instead.