I have File1.ps1 containing the command as follows:
$VariableArray = "PrincipleName='Jack'"
Invoke-Sqlcmd -InputFile "C:\Amit\Test.sql" -Variable $VariableArray -ServerInstance "3STOOGES"
my Test.sql contains
--Test.sql
declare @PrincipleName varchar(20)
SELECT 'PrincipleName=' + @PrincipleName
This gives me output as
Column1
-------
I tried something mentioned here
I tried the options for $(PrincipleName) inside the Test.sql but it complained the SQL server Management Studio.
Please advise as I Have SQL server 2012 with Powershell 3.0 on Windows 2012
