Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 使用oledb提供程序和字符串执行sql语句时发生Powershell异常_String_Powershell_Oledbconnection - Fatal编程技术网

String 使用oledb提供程序和字符串执行sql语句时发生Powershell异常

String 使用oledb提供程序和字符串执行sql语句时发生Powershell异常,string,powershell,oledbconnection,String,Powershell,Oledbconnection,我怀疑字符串和处理有问题。我试着在这里读字符串,但我感到困惑 这: 抛出: Exception calling "ExecuteReader" with "0" argument(s): "SQL0104: Token ,3 was not valid. Valid tokens: ) ,. Cause . . . . . : A syntax error was detected at token ,3. Token ,3 is not a valid token. A partial

我怀疑字符串和处理有问题。我试着在这里读字符串,但我感到困惑

这:

抛出:

Exception calling "ExecuteReader" with "0" argument(s): "SQL0104: Token ,3 was not valid. Valid tokens: ) ,.
Cause . . . . . :   A syntax error was detected at token ,3.  Token ,3 is not a valid token.  A partial list of valid tokens is ) ,.  This list 
assumes that the statement is correct up to the token.  The error may be earlier in the statement, but the syntax of the statement appears to be 
valid up to this point. Recovery  . . . :   Do one or more of the following and try the request again: -- Verify the SQL statement in the area of 
the token ,3. Correct the statement.  The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to 
the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause."

您的SQL方言(IBM DB2,我收集?)可能没有
LEFT
函数。尝试
像'115%'这样的bidag
。无论如何,您的问题似乎在SQL语句中,而不是从Powershell调用它的方式。它在Powershell之外工作吗?它工作,但我认为它使用jdbc和odbc。。原始SQL语句并不是那么简单。它使用的函数有:MOD、SUBSTRING、leftbutleftexist:我确实说过“may”。我没有DB2方面的经验。:-)如果它确实是DB2,那么您应该添加适当的标记(
sql
DB2
),以便专家能够参与进来。
Exception calling "ExecuteReader" with "0" argument(s): "SQL0104: Token ,3 was not valid. Valid tokens: ) ,.
Cause . . . . . :   A syntax error was detected at token ,3.  Token ,3 is not a valid token.  A partial list of valid tokens is ) ,.  This list 
assumes that the statement is correct up to the token.  The error may be earlier in the statement, but the syntax of the statement appears to be 
valid up to this point. Recovery  . . . :   Do one or more of the following and try the request again: -- Verify the SQL statement in the area of 
the token ,3. Correct the statement.  The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to 
the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause."
$sql = 
@"
select count(*) from f6161001 where left(bidag,3)='115'
"@