Forum Discussion
Pass Parameters To SQL Stored Procedure From Excel
- 6 years ago
Hi UncleLewis ,
The & is used to connet the string, you could refer to edhans 's suggestions to use ' ' ' in query. By the way, did you want to pass multiple parameters? If so, I think you could change your store prcedured like below(split_string is a split stored procedure)
create proc testp @a varchar(20) as select * from test1 where name in (select value from Split_String(@a, ','))Then change your M code like below(use " as Escape Characters )
let Source = Sql.Database("localhost", "newsql", [Query="exec testp '"¶&"'"]) in SourceBest Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I don't know how your stored procedure works, but the last thing you are passing is this:
"'"
That single quote doesn't look right.
For a full overview of stored procedures and parameters from Power Query, see this article.
Thanks,
Doesn't the ampersand concatenate the different strings together?
So really everything between {} one continuous string broken over multiple lines?
Thanks
- dax6 years agoCommunity Support
Hi UncleLewis ,
The & is used to connet the string, you could refer to edhans 's suggestions to use ' ' ' in query. By the way, did you want to pass multiple parameters? If so, I think you could change your store prcedured like below(split_string is a split stored procedure)
create proc testp @a varchar(20) as select * from test1 where name in (select value from Split_String(@a, ','))Then change your M code like below(use " as Escape Characters )
let Source = Sql.Database("localhost", "newsql", [Query="exec testp '"¶&"'"]) in SourceBest Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.