문제

I'm trying this and it's failing

PS C:\Users\MooMin>$i = "MySQLInstanceName"
PS C:\Users\MooMin>& sqlcmd -S $i -E -q"SELECT @@VERSION"

I get this error:

Unrecognized token in source text.
At line:1 char:31
+ & sqlcmd -S "$i" -E -q"SELECT  <<<< @@VERSION"
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnrecognizedToken

What am I doing wrong?

도움이 되었습니까?

해결책

A space is missing between -q and tsql statement. Try like so,

sqlcmd -S $i -E -q "SELECT @@VERSION"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top