PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

[Question] - Variables

Open dazinator opened this issue 5 years ago • 0 comments

SqlCmd allows you to pass variable values that can be used in scripts:

& sqlcmd -i CreateDb.sql -v dbName="foo"

CreateDb.sql:

CREATE DATABASE $(dbName)
ON (
  NAME = $(dbName)
)
LOG ON (
  NAME = $(dbName)_log,  
)

These are different from SQL parameters.

Does Invoke-SqlCmd2 cater for this functionality somehow? Thanks

dazinator avatar Aug 01 '18 13:08 dazinator