The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Team,
In my project i have requirement to execute stored procedure using 2 dynamic parameter in Direct query method. I am able to execute the procedure using one parameter. But, when I try to execute 2 parameter i am getting error.
Below is the screenshot of power M query code from advance editor. and error also attaching.
It would be really helpful if anyone of here can help me to fix this issue.
Thanks in advance.
count your single quotes. You are missing a couple and forgot to escape others.
After checking all the quotes still i am getting the same error.
let CompanyId = Text.From(P_COMPANY_ID), // Ensure P_COMPANY_ID is defined PeriodRange = Text.From(periodRange), // Ensure periodRange is defined EscapedPeriodRange = "'" & Text.Replace(PeriodRange, "'", "''") & "'", // Escape single quotes in periodRange Query = "SELECT * FROM OPENROWSET('SQLNCLI','Server=.......\XportUAT;Trusted_Connection=yes;','EXEC Xport_UAT_NEW.dbo.USP_GET_PERIOD_DATA_FS_BY_PERIODRANGE_SH @pCompany_Id=" & CompanyId & ", @PeriodRange=" & EscapedPeriodRange & "')", Source = Sql.Database("......\XportUAT", "Xport_UAT_NEW", [Query=Query]) in Source
I tried new above code. Could you please let me know where i am doing mistake. it would be helpful if you can suggest me in detail.
what's the purpose of
SELECT * FROM OPENROWSET
?
Looks like your SP is not even part of the query.
SELECT * FROM OPENROWSET
That link is irrelevant and/or misleading.