Question

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?

Was it helpful?

Solution

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

sqlcmd -S $i -E -q "SELECT @@VERSION"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top