Forum Discussion

RobertSlattery's avatar
RobertSlattery
Responsive Resident
2 years ago

Native query on OLEDB source with parameteres doesn't work

I have a native query with a parameterised where caluse like this...

WHERE CALDATE > @datefrom AND CLDATE < @dateto

I try to query it 

let
    Source = OleDb.DataSource("provider=IBMDASQL.DataSource.1;data source=serverconnection),
    Database = Source{[Name="SERVER",Kind="Database"]}[Data],
    calendar = Value.NativeQuery(Database,Query1, [datefrom="20230701",dateto="20240701"])
in
    calendar

This results in a datasource error, Column or global variable @DATEFROM not found.

I guess the parameters are not being picked up by Value.NativeQuery.

If I remove the parameters from the where clause, or replace with literal values, it runs fine.

Is this not supported for OLEDB?

1 Reply