In my first article, I covered how I can call a stored procedure from PowerShell (PoSh) and storing the results in a file. Someone asked a question about how to call a stored procedure with a parameter, which is a good question to ask, and a natural extension of what I wrote. Here I’m going to cover a couple ways to call stored procedures with parameters.
The Simple Yet Insecure Way
Let’s start with a simple way of calling a stored procedure based on the code in the previous article. This will essentially involve using some PoSh string substitution. For