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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
bkoenen
Helper I
Helper I

Stored SQL Procedure with 3 parameters get the values from another table in same Excel file

Hello,

I want to Execute a stored SQL Procedure in Excel and get the Parameters from an existing table in the same Excel book, so that users can fill in the parameters.

 

The stored procedure works fine when I fill in the parameters like this:
= Sql.Database("SQL01", "640", [Query="EXECUTE DBO._sp_memoriaal '2023', '1', '6'"])

 

I would like to fill in the parameters from the Parameters table which have 3 columns.

 

Parameters table.png

 

So the code should be something like this so it gets the values from the Parameters table:

= Sql.Database("SQL01", "640", [Query="EXECUTE DBO._sp_memoriaal, Table.Column(Parameters, 'Jaar', 'VanPeriode', 'TmPeriode')"])

 

But I don't know what the correct code should be to get this done?

Kinde regards,

Björn

2 REPLIES 2
ThxAlot
Super User
Super User

 

= Sql.Database("SQL01", "640", [Query="EXEC [dbo].[_sp_memoriaal] '" & Text.Combine(List.Transform(Table.ToRows(Parameters){0},Text.From),"','") & "'"])

 

ThxAlot_0-1690826098792.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Hello,

Thank you for the solution, it works fine 👍

Just one thing, in the Workbook I use a sheet where the users can fill the Parameters (Table2) that are used in the Query for the stored procedure. When I change the cell value C2 in value "4", and then refresh everything, it changes the value back into the current value "6".  How to solve this that it takes the value "4"?

 

Table_2.png

 

Parameters code:

let
    Bron = Excel.CurrentWorkbook(){[Name="Tabel2"]}[Content],
    #"Type gewijzigd1" = Table.TransformColumnTypes(Bron,{{"Kolom2", Int64.Type}, {"Kolom1", type text}}),
    #"Type gewijzigd" = Table.TransformColumnTypes(#"Type gewijzigd1",{{"Kolom1", type text}, {"Kolom2", Int64.Type}}),
    #"Gedraaide kolom" = Table.Pivot(#"Type gewijzigd", List.Distinct(#"Type gewijzigd"[Kolom1]), "Kolom1", "Kolom2")
in
    #"Gedraaide kolom"

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors