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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
anudeep3721
New Member

calling stored procedure using parameter error

Hi.. i'm calling a stored procedure(SQL) in powerbi using direct query it is executed successfully by passing value manually. Now i'm trying to execute the value using parameter option in powerbi , so when i pass the value to powerbi and execute, it throws me an error "DataSource.Error: Microsoft SQL: Error converting data type nvarchar to uniqueidentifier." . Is there any way we can convert it to uniqueidentifier. Any help would be appreciated.

1 ACCEPTED SOLUTION
v-caliao-msft
Microsoft Employee
Microsoft Employee

@anudeep3721,

 

We can use parameter when call store procedure. Smaple query for you reference.

let
    SQLSource = (param1 as date, param2 as date) =>
let  
    Source = Sql.Database("servername", "databasename", [Query="exec p4test '"& Date.ToText(param1) & "','" & Date.ToText(param2)&"' #(lf)#(lf)#(lf) #(lf)"])
in
    Source
in
    SQLSource

Regards,

Charlie Liao

View solution in original post

2 REPLIES 2
v-caliao-msft
Microsoft Employee
Microsoft Employee

@anudeep3721,

 

We can use parameter when call store procedure. Smaple query for you reference.

let
    SQLSource = (param1 as date, param2 as date) =>
let  
    Source = Sql.Database("servername", "databasename", [Query="exec p4test '"& Date.ToText(param1) & "','" & Date.ToText(param2)&"' #(lf)#(lf)#(lf) #(lf)"])
in
    Source
in
    SQLSource

Regards,

Charlie Liao

Seth_C_Bauer
Community Champion
Community Champion

@anudeep3721 Pass the text and do the conversion of the value in the stored procedure. That would probably be the most straight forward.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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