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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. 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

Anonymous
Not applicable

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.