Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Passing numeric parameter in Oracle custom SQL

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!

1 ACCEPTED 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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi @v-shex-msft 

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.