【发布时间】:2018-09-17 06:50:21
【问题描述】:
我希望将字符串数组作为查询参数传递给IN 运算符。我已经为此苦苦挣扎了一段时间,但我尝试的任何方法似乎都不起作用。我想知道这是否可能做到。
我尝试了以下语法变体:
where state IN (@states)
where state IN @states
where state IN ARRAY(@states)
where state IN (ARRAY(@states))
这是 C# 的结尾:
new BigQueryParameter("states", BigQueryDbType.Array, new[] {"AL", "CA"}),
new BigQueryParameter("states", null, new[] {"AL", "CA"}),
我会遇到各种错误,具体取决于我的尝试:
- 对于参数类型 STRING 和 {ARRAY} 的运算符 IN 没有匹配的签名
- 语法错误:应为“(”或关键字 SELECT 或关键字 WITH 但得到“@”
- 语法错误:应为“(”或关键字 UNNEST,但得到关键字 ARRAY
- 语法错误:应为“(”或关键字 UNNEST 但得到“@”
【问题讨论】:
-
那么,你查到
UNNEST了吗?它看起来不像你做想要的吗? -
我没想到。我认为只做
IN (@states)必须工作。感谢您的提示。
标签: c# google-bigquery