Many of us are likely aware of PowerShell, even if we don’t use it too frequently, and I suspect that if you’re reading this post you’re also familar with things like
sqlcmd
. Hopefully, you have also heard of DbaTools, a module for PowerShell (and if you haven’t, hopefully that’s why you’re here). Today, I wanted to discuss running parametrised queries (including table type parameters) from PowerShell, which is notorious hard/impossible withsqlcmd
(orinvoke-SqlCmd
), using the DbaTools module.
Click through for examples building up from zero parameters up to a table of parameters.