Hi,
I’m running a simple SQLCMD in a new set up of Octopus on a listening tentacle.
“D:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\sqlcmd.exe” -S $DatabaseServer -E -b -v DBName="$CustomerDatabaseDWCS" -v NewServer="$DatabaseServer" -v NewDatabase="$CustomerDatabaseDWH" -i"D:\TeamCity\SQLScripts\UpdateCPForNewServerName.sql"
All the sql does is update some rows on a table.
At C:\Octopus\Work\20180705103947-1312-21\Script.ps1:1 char:83
July 5th 2018 11:39:49
Error
- … soft SQL Server\Client SDK\ODBC\130\Tools\Binn\sqlcmd.exe" -S $Databa …
July 5th 2018 11:39:49
Error -
~~
July 5th 2018 11:39:49
Error
Unexpected token ‘-S’ in expression or statement.
July 5th 2018 11:39:49
Error
At C:\Octopus\Work\20180705103947-1312-21\Script.ps1:1 char:86
July 5th 2018 11:39:49
Error
- … Client SDK\ODBC\130\Tools\Binn\sqlcmd.exe" -S $DatabaseServer -E -b - …
July 5th 2018 11:39:49
Error -
~~~~~~~~~~~~~~~
July 5th 2018 11:39:49
Error
Unexpected token ‘$DatabaseServer’ in expression or statement.
July 5th 2018 11:39:49
Error
At C:\Octopus\Work\20180705103947-1312-21\Script.ps1:1 char:102
July 5th 2018 11:39:49
Error
- … ent SDK\ODBC\130\Tools\Binn\sqlcmd.exe" -S $DatabaseServer -E -b -v D …
July 5th 2018 11:39:49
Error -
~~
July 5th 2018 11:39:49
Error
Unexpected token ‘-E’ in expression or statement.
July 5th 2018 11:39:49
Error
At C:\Octopus\Work\20180705103947-1312-21\Script.ps1:1 char:105
July 5th 2018 11:39:49
Error
- … SDK\ODBC\130\Tools\Binn\sqlcmd.exe" -S $DatabaseServer -E -b -v DBNa …
July 5th 2018 11:39:49
Error -
~~
July 5th 2018 11:39:49
Error
Unexpected token ‘-b’ in expression or statement.
July 5th 2018 11:39:49
Error
+ CategoryInfo : ParserError: ( [], ParentContainsErrorRecordException
July 5th 2018 11:39:49
Error
+ FullyQualifiedErrorId : UnexpectedToken
July 5th 2018 11:39:49
Error
July 5th 2018 11:39:49
Fatal
The remote script failed with exit code 1
July 5th 2018 11:39:49
Fatal
The action Update Data for Customer Source information on DEVSQL20SH01 (Customer) failed
With the correct values (those passed in) the command runs fine using a cmd window, but gives the same error in Powershell. Have you any ideas why this would be? It runs ok in powershell from TeamCity on a separate server.
Cheers,
Anthony