I've setup a simple sqlcmd script. Contents below.
use $(dbname);
select * from $(tablename)
I'm then running the following Invoke SQLCMD
$SQLCMDVarArr = "dbname='MyDatabase'", "Tablename='MyTable'"
INVOKE-SQLCMD -ServerInstance MyServer\MyInstance -inputFile '\\MyShare\Database\Sprints\csrtemp2\csrtest.sql' -variable $SQLCMDVarArr
And I'm getting the error:
INVOKE-SQLCMD : Incorrect syntax near 'MyDatabase'.
I pulled the syntax straight from the invoke-sqlcmd get-help examples. Can anyone tell me what is wrong with this?
Thanks,
as per request this is running on windows Server 2008 R2