microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)

Home Page:https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EXIT command not parsed in powershell using -Q

amafernandes opened this issue · comments

In go-sqlcmd 1.6.0 the powershell script bellow, produces and error, this is output of variable $result:

Msg 102, Level 15, State 1, Server ., Line 4
Incorrect syntax near ':'.

Running the same script using ODBC sqlcmd works properly.

$result = sqlcmd -b -X1 -E -W -h -1 -Q "
Select 2;

:EXIT(SELECT 200)"

echo $LASTEXITCODE
echo $result