Forum Discussion
DukeCarey
2 years agoRegular Visitor
Pass date parameter to a SQL function
I need to pull data via a SQL function that requires a date parameter. The SQL query is very simple: SELECT * FROM dbo.FunctionName('20230630'). All the search results I've found focus on usin...
- 2 years ago
DukeCarey
I created a parameter, called startdate, in your case it is linked to an Excel sheet, it;s fine. Here is the modified code, which should work for as well. Modify the Date format as per your source system.let DateParam = "'" & Date.ToText(StartDate, "yyyy-MM-dd") & "'", Source = Sql.Database(".", "ContosoRetailDW_2019", [Query="SELECT * FROM dbo.GetCustomersByDateFirstPurchase(" & DateParam & ")", CreateNavigationProperties=false]) in Source
DukeCarey
2 years agoRegular Visitor
Thanks Fowmy, I think we're inching closer now. After mimicking what you posted I ran into the formula.firewall error and I'm stumped there now.
Formula.Firewall: Query 'PivotPurchaseTypesSince' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.