Forum Discussion
s_schultes
5 months agoFrequent Visitor
Dynamic M Parameter, SQL
Hi, i was trying to connect the database (MS SQL Server) via direct query and therefore use two dynamic parameters (datetime) for the SQL query. I have two parameters (Start and End) which ar...
AnkitKukreja
5 months agoSuper User
Hi! s_schultes
The data can be seen because it's a DQ and issue is not recognized at PQ. But when we use the data in visuals it runs the query (DQ) again which looks out if query folding is happening. I don't have a scenario to reproduce, but I gave it a try. Please use below code if that doesn't work go through the below video in case that helps.
let
Source = Sql.Database(
"db",
"slave",
[
Query = "
SELECT belegid, datum, abteilung, artikelid, menge
FROM form_belegposition
WHERE datum >= @StartDate
AND datum < DATEADD(DAY, 1, @EndDate)
",
Parameters = [
StartDate = StartDate,
EndDate = EndDate
]
]
)
in
Source