我正在尝试这个并且它失败了
PS C:\Users\MooMin>$i = "MySQLInstanceName"
PS C:\Users\MooMin>& sqlcmd -S $i -E -q"SELECT @@VERSION"
我收到此错误:
Unrecognized token in source text.
At line:1 char:31
+ & sqlcmd -S "$i" -E -q"SELECT <<<< @@VERSION"
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
我做错了什么?
答案 0 :(得分:1)
-q
和tsql语句之间缺少空格。试试这样,
sqlcmd -S $i -E -q "SELECT @@VERSION"