Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I want to pass a numeric parameter into my custom SQL like below
Select .....
where.....
and FRS.SNAPSHOT_DATE_KEY > "&_SnapshotDateParam_&"
....
I have the parameter _SnapshotDateParam_ set as 20190501
However I suspect it is trying to pass the SQL through as
Select .....
where.....
and FRS.SNAPSHOT_DATE_KEY> &20190501&
....
Due to the following error I get:
Expression.Error: We cannot apply operator & to types Text and Number.
Details:
Operator=&
Left=select.......
.....
Right=20190705
I have tried several different permeations to get this working, to no avail!
Please help!
Solved! Go to Solution.
Hi @Anonymous ,
Current you can only merge t-sql string with text value. For your requirement, it means you need to add some t-sql convert type functions to convert these text type parameters.
Regards,
Xiaoxin Sheng
Hi @Anonymous ,
It seems like power query not allow you direct merge numeric value and text value, you can add Text.From function to force convert parameter value fix this.
let
Source= Sql.Database("testDB", "test", [Query="Select * from Calendar where Datekey >"&Text.From(DatekeyPara)])
in
Source
Regards,
Xiaoxin Sheng
Hi @Anonymous
Both are numeric though?
It appeears that the paramter is somehow being transformed into text
Hi @Anonymous ,
Current you can only merge t-sql string with text value. For your requirement, it means you need to add some t-sql convert type functions to convert these text type parameters.
Regards,
Xiaoxin Sheng
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |