dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 788 forks source link

Invoke-DbaQuery - Example 9, Output from New-DbaSqlParameter not used #9222

Closed whoisbruce closed 4 months ago

whoisbruce commented 5 months ago

The last two lines read PS C:> New-DbaSqlParameter -SqlDbType structured -Value $inparamAsDataTable -TypeName 'dbatools_tabletype' PS C:> Invoke-DbaQuery -SqlInstance localhost -Database master -CommandType StoredProcedure -Query my_proc -SqlParameter $inparamAsDataTable

I think it should be more like PS C:> $inparamAsSQLParameter = New-DbaSqlParameter -SqlDbType structured -Value $inparamAsDataTable -TypeName 'dbatools_tabletype' PS C:> Invoke-DbaQuery -SqlInstance localhost -Database master -CommandType StoredProcedure -Query myproc -SqlParameter $inparamAsSQLParameter_

niphlod commented 5 months ago

hey @whoisbruce , thanks for the report. There's another pending PR on invoke-dbaquery so as soon as that is merged I'll push a new PR to fix the documentation issue.