SnowConvert AI - BigQuery - 組み込み関数

BigQuery の SnowConvert AI によってサポートされているすべての組み込み関数の変換リファレンス。

注釈

組み込み関数とそれに相当するSnowflake関数の詳細については、[一般的な組み込み関数](../../translation-references/general/built-in-functions)もご参照ください。

集計関数

BigQuery

Snowflake

[ANY_VALUE](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#any_value)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/any_value">ANY_VALUE</a><br><br><em> 注意:BigQuery と異なり、Snowflakeは NULLs を無視しません。さらに、Snowflakeの <code>OVER()</code> 句は、<code>ORDER BY</code> または明示的なウィンドウフレームの使用をサポートしていません。 </em></p>

ANY_VALUE( expr1, HAVING MAX expr2)

ANY_VALUE( expr1, HAVING MIN expr2)

MAX_BY(expr1, expr1)

MIN_BY(expr1, expr2)

[AVG](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#avg)

[AVG](https://docs.snowflake.com/en/sql-reference/functions/avg)

[COUNT](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#count)

[COUNT](https://docs.snowflake.com/en/sql-reference/functions/count)

[COUNTIF](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#countif)

[COUNT_IF](https://docs.snowflake.com/en/sql-reference/functions/count_if)

[LOGICAL_AND](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#logical_and)

[BOOLAND_AGG](https://docs.snowflake.com/en/sql-reference/functions/booland_agg)

[LOGICAL_OR](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#logical_or)

[BOOLOR_AGG](https://docs.snowflake.com/en/sql-reference/functions/boolor_agg)

[MAX](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#max)

[MAX](https://docs.snowflake.com/en/sql-reference/functions/max)

[MIN](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#min)

[MIN](https://docs.snowflake.com/en/sql-reference/functions/min)

[SUM](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#sum)

[SUM](https://docs.snowflake.com/en/sql-reference/functions/sum)

配列関数

BigQuery

Snowflake

[ARRAY_AGG](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#array_agg)

[ARRAY_AGG](https://docs.snowflake.com/en/sql-reference/functions/array_agg)

[ARRAY_CONCAT](https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#array_concat)

[ARRAY_CAT](https://docs.snowflake.com/en/sql-reference/functions/array_cat)

[ARRAY_CONCAT_AGG](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#array_concat_agg)

[ARRAY_FLATTEN](https://docs.snowflake.com/en/sql-reference/functions/array_flatten)

[ARRAY_TO_STRING](https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#array_to_string)(expr, delimiter)

[ARRAY_TO_STRING](https://docs.snowflake.com/en/sql-reference/functions/array_to_string)(ARRAY_COMPACT(expr), delimiter)

[ARRAY_TO_STRING](https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#array_to_string)(expr, delimiter, null_text)

<p>ARRAY_TO_STRING_UDF(expr, delimiter, null_text)<br><br><em>Notes: SnowConvert AI generates a UDF to handle the NULL replacement parameter which is not natively supported in Snowflake's ARRAY_TO_STRING function.</em></p>

[SELECT ARRAY](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#array_subquery) (SELECT query)

<p>SELECT (SELECT ARRAY_AGG(*) FROM (SELECT query))<br><br><em> 注記: BigQuery の ARRAY サブクエリ構文は、Snowflakeではサブクエリを伴う ARRAY_AGG を使用する形式に変換されます。 </em></p>

条件式

BigQuerySnowflake
COALESCECOALESCE
IFIFF
IFNULLIFNULL
NULLIFNULLIF

変換関数

BigQuery

Snowflake

[SAFE_CAST](https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#safe_casting)

[TRY_CAST](https://docs.snowflake.com/en/sql-reference/functions/try_cast)

日付関数

BigQuery

Snowflake

CURRENT_DATE
CURRENT_DATE()

CURRENT_DATE

CURRENT_DATE()

[FORMAT_DATE](https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#format_date)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/to_char">TO_CHAR</a><br><br><em> 注意:この変換の詳細については、こちらの </em><a href="format_date.md"><em>ページ</em></a><em> をご覧ください。 </em></p>

日付時刻関数

BigQuery

Snowflake

CURRENT_DATETIME

CURRENT_DATETIME()

CURRENT_TIMESTAMP :: TIMESTAMP_NTZ
CURRENT_TIMESTAMP() :: TIMESTAMP_NTZ

地理関数

BigQuery

Snowflake

[ST_GEOGFROMTEXT](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geogfromtext)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/st_geographyfromwkt">ST_GEOGFROMTEXT</a><br><br><em> 注意:この変換の詳細については、こちらの </em><a href="st_geogfromtext.md"><em>ページ</em></a><em> をご覧ください。 </em></p>

[ST_GEOGPOINT](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geogpoint)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/st_makepoint">ST_POINT</a><br><br><em> 注意:この変換の詳細については、こちらの </em><a href="st_geogpoint.md"><em>ページ</em></a><em> をご覧ください。 </em></p>

JSON 関数

BigQuery

Snowflake

[JSON_VALUE](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_value) / [JSON_EXTRACT_SCALAR](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_extract_scalar)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/json_extract_path_text">JSON_EXTRACT_PATH_TEXT</a><br></p><p><em> 注記: SnowConvert AI は、BigQuery JSON のパスを Snowflakeと等価なものに自動的に変換します。 </em></p>

[JSON_VALUE_ARRAY](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_value_array)

<p>JSON_VALUE_ARRAY_UDF<br><br><em> 注意: SnowConvert AI は、 JSON から配列を抽出する際に同等の動作を得るための UDF を生成します。 </em></p>

[LAX_INT64](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#lax_int64)

<p>PUBLIC.LAX_INT64_UDF<br><br><em> 注記: SnowConvert AI は、同等の動作を得るための UDF を生成します。 </em></p>

[LAX_BOOL](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#lax_bool)

<p>PUBLIC.LAX_BOOL_UDF<br><br><em> 注意: SnowConvert AI は、同等の動作を得るための UDF を生成します。 </em></p>

数学関数

BigQuery

Snowflake

[ABS](https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#abs)

[ABS](https://docs.snowflake.com/en/sql-reference/functions/abs)

[LEAST](https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#least)

[LEAST](https://docs.snowflake.com/en/sql-reference/functions/least)

[MOD](https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#mod)

[MOD](https://docs.snowflake.com/en/sql-reference/functions/mod)

ROUND(X)
ROUND(X, Y)
ROUND(X, Y, 'ROUND_HALF_EVEN')
ROUND(X, Y, 'ROUND_HALF_AWAY_FROM_ZERO')

ROUND(X)
ROUND(X, Y)
ROUND(X, Y, 'HALF_TO_EVEN')
ROUND(X, Y, 'HALF_AWAY_FROM_ZERO')

番号付け関数

BigQuery

Snowflake

[RANK](https://cloud.google.com/bigquery/docs/reference/standard-sql/numbering_functions#rank)

[RANK](https://docs.snowflake.com/en/sql-reference/functions/rank)

[ROW_NUMBER](https://cloud.google.com/bigquery/docs/reference/standard-sql/numbering_functions#row_number)

[ROW_NUMBER](https://docs.snowflake.com/en/sql-reference/functions/row_number)

文字列関数

BigQuery

Snowflake

[BYTE_LENGTH](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#byte_length)(expr)

<p>LENGTH(TO_BINARY(HEX_ENCODE(expr)))<br><br><em> 注意: BigQuery の BYTE_LENGTH は、エンコードされた文字列のバイト数を返します。Snowflakeの同等機能では、バイト長を取得するために、HEXエンコードした後でバイナリに変換します。 </em></p>

CHARACTER_LENGTH
CHAR_LENGTH

[LENGTH](https://docs.snowflake.com/en/sql-reference/functions/length)

[CONCAT](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#concat)

[CONCAT](https://docs.snowflake.com/en/sql-reference/functions/concat)

[ENDS_WITH](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#ends_with)

[ENDSWITH](https://docs.snowflake.com/en/sql-reference/functions/endswith)

[FROM_BASE64](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#from_base64)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/try_base64_decode_binary">TRY_BASE64_DECODE_BINARY</a><br><br><em> 注意:バイナリデータ出力の場合、 BigQuery のデフォルトは BASE64 ですが、Snowflakeでは HEX が使用されます。Snowflakeでは、 </em> <a href="https://docs.snowflake.com/en/sql-reference/functions/base64_encode"><em><code>BASE64_ENCODE</code></em></a> <em> 関数を使用するか、 </em> <a href="https://docs.snowflake.com/en/sql-reference/parameters#binary-output-format"><em><code>BINARY_OUTPUT_FORMAT</code></em></a> <em> を <code>'BASE64'</code> に設定して、 BASE64 でバイナリデータを表示できます。 </em></p>

[FROM_HEX](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#from_hex)

<p><a href="https://docs.snowflake.com/en/sql-reference/functions/try_hex_decode_binary">TRY_HEX_DECODE_BINARY</a><br><br><em> 注意:バイナリデータ出力の場合、 BigQuery のデフォルトは BASE64 ですが、Snowflake では HEX が使用されます。Snowflakeでは、 </em> <a href="https://docs.snowflake.com/en/sql-reference/functions/base64_encode"><em><code>BASE64_ENCODE</code></em></a> <em> 関数を使用するか、 </em> <a href="https://docs.snowflake.com/en/sql-reference/parameters#binary-output-format"><em><code>BINARY_OUTPUT_FORMAT</code></em></a> <em> を <code>'BASE64'</code> に設定して、 BASE64 でバイナリデータを表示できます。 </em></p>

[LEFT](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#left)

[LEFT](https://docs.snowflake.com/en/sql-reference/functions/left)

[LENGTH](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#length)

[LENGTH](https://docs.snowflake.com/en/sql-reference/functions/length)

[LOWER](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#lower)

[LOWER](https://docs.snowflake.com/en/sql-reference/functions/lower)

[LPAD](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#lpad)

[LPAD](https://docs.snowflake.com/en/sql-reference/functions/lpad)

[LTRIM](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#ltrim)

[LTRIM](https://docs.snowflake.com/en/sql-reference/functions/ltrim)

[REGEXP_CONTAINS](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_contains)(value, regexp)

[REGEXP_INSTR](../../../..//sql-reference/functions/regexp_instr.rst)(value, regexp) > 0

[REGEXP_EXTRACT_ALL](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_extract_all)

[REGEXP_SUBSTR_ALL](https://docs.snowflake.com/en/sql-reference/functions/regexp_substr_all)

[REPLACE](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#replace)

[REPLACE](https://docs.snowflake.com/en/sql-reference/functions/replace)

[RIGHT](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#right)

[RIGHT](https://docs.snowflake.com/en/sql-reference/functions/right)

[RPAD](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#rpad)

[RPAD](https://docs.snowflake.com/en/sql-reference/functions/rpad)

[RTRIM](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#rtrim)

[RTRIM](https://docs.snowflake.com/en/sql-reference/functions/rtrim)

[SPLIT](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#split)

[SPLIT](https://docs.snowflake.com/en/sql-reference/functions/split)

[STARTS_WITH](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#starts_with)

[STARTSWITH](https://docs.snowflake.com/en/sql-reference/functions/startswith)

<p><a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#substr">SUBSTR</a> (文字列、位置) <br><br><a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#substring">SUBSTRING</a> (文字列、位置) <br><br><a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#substr">SUBSTR</a> (文字列、位置、長さ) <br><br><a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#substring">SUBSTRING</a> (文字列、位置、長さ) </p>

SUBSTR(string, IFF(position < -LENGTH(string), 1, position))

SUBSTRING(string, IFF(position < -LENGTH(string), 1, position))

SUBSTR(sttring, IFF(position < -LENGTH(string), 1, position), length)

SUBSTRING(sttring, IFF(position < -LENGTH(string), 1, position), length)

[TO_HEX](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#to_hex)

[HEX_ENCODE](https://docs.snowflake.com/en/sql-reference/functions/hex_encode)

[UPPER](https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#upper)

[UPPER](https://docs.snowflake.com/en/sql-reference/functions/upper)

タイムスタンプ関数

BigQuery

Snowflake

CURRENT_TIMESTAMP
CURRENT_TIMESTAMP()

CURRENT_TIMESTAMP

CURRENT_TIMESTAMP()

[SAFE.TIMESTAMP_MILLIS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_millis)

<p>IFF(expr BETWEEN -62135596800000 AND 253402300799999, TO_TIMESTAMP(expr / 1000), null)<br><br><em> 注意::オーバーフローエラーを防ぐための範囲検証を備えた安全なバージョン。 </em></p>

[SAFE.TIMESTAMP_SECONDS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_seconds)

<p>SAFE_TIMESTAMP_SECONDS_UDF(expr)<br><br><em> 注意: SnowConvert AI は、エラー処理による安全なタイムスタンプ変換を提供するために UDF を生成します。 </em></p>

[TIMESTAMP_MILLIS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_millis)

<p>TO_TIMESTAMP(expr / 1000)<br><br><em> 注記:エポックからのミリ秒を1000で割ってタイムスタンプに変換します。 </em></p>

[TIMESTAMP_SECONDS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_seconds)(expr)

<p>DATEADD('seconds', expr, '1970-01-01')<br><br><em> 注意:Unixのエポック開始日に秒を追加します。 </em></p>

[UNIX_MICROS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#unix_micros)(タイムスタンプ)

<p>DATE_PART('epoch_microsecond', CONVERT_TIMEZONE('UTC', timestamp))<br><br><em> 注意:UTC に変換されたタイムスタンプからUnixエポックからのマイクロ秒を抽出します。 </em></p>

[UNIX_MILLIS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#unix_millis)(timestamp)

<p>DATE_PART('epoch_millisecond', CONVERT_TIMEZONE('UTC', timestamp))<br><br><em> 注意:UTC に変換されたタイムスタンプからUnixのエポックからのミリ秒を取り出す。 </em></p>

[UNIX_SECONDS](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#unix_seconds)(timestamp)

<p>DATE_PART('epoch_seconds', CONVERT_TIMEZONE('UTC', timestamp))<br><br><em> 注意:UTC に変換されたタイムスタンプから、Unixエポック以降の秒数を抽出します。 </em></p>

FORMAT_DATE

Format_date関数

説明

指定された形式文字列に従って DATE 値を書式設定します。

詳細については、[FORMAT_DATE](https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#format_date)関数をご参照ください。

文法構文

 FORMAT_DATE(format_string, date_expr)
Copy

サンプルソース

BigQuery
CREATE TABLE TEST_DATE (col1 DATE);
SELECT FORMAT_DATE('%Y', col1);
Copy
Snowflake
CREATE TABLE TEST_DATE (col1 DATE);
SELECT
  TO_CHAR(col1, 'YYYY')
FROM
  TEST_DATE;
Copy

BigQuery 形式の同等性

BigQuerySnowflake
%APUBLIC.DAYNAME_LONG_UDF(date_expr)

Note: Generate UDF in conversion for support.
%aDY
%BMMMM
%bMON
%CPUBLIC.CENTURY_UDF(date_expr)

Note: Generate UDF in conversion for support.
%cDY MON DD HH24:MI:SS YYYY
%DMM/DD/YY
%dDD
%eDD
%FYYYY-MM-DD
%GYEAROFWEEKISO(date_expr)
%gPUBLIC.ISO_YEAR_PART_UDF(date_expr, 2)

Note: Generate UDF in conversion for support.
%HHH24
%hMON
%IHH12
%JPUBLIC.DAY_OF_YEAR_ISO_UDF(date_expr)

Note: Generate UDF in conversion for support.
%jDAYOFYEAR(date_expr)
%kHH24
%lHH12
%MMI
%mMM
%nNot equivalent format
%Ppm
%pAM
%QQUARTER(date_expr)
%RHH24:MI
%SSS
%sNot equivalent format
%THH24:MI:SS
%tNot equivalent format
%UWEEK(date_expr)
%uDAYOFWEEKISO(date_expr)
%VWEEKISO(date_expr)
%WWEEK(date_expr)

Note: Unlike BigQuery, Snowflake results are dictated by the values set for the WEEK_OF_YEAR_POLICY and/or WEEK_START session parameters. So, results could differ from BigQuery based on those parameters.
%wDAYOFWEEK(date_expr)

Note: Unlike BigQuery, Snowflake results are dictated by the values set for the WEEK_OF_YEAR_POLICY and/or WEEK_START session parameters. So, results could differ from BigQuery based on those parameters.
%XHH24:MI:SS
%xMM/DD/YY
%YYYYY
%yYY
%ZNot equivalent format
%zNot equivalent format
%EzNot equivalent format
%E<number>SNot equivalent format
%E*SNot equivalent format
%EY4YYYY

警告

BigQuery では、型が DATE の場合、時間に関連する形式は適用されませんが、Snowflakeは HH:MI:SS の使用法に対して、値がゼロの形式を適用します。

注釈

詳細については、[BigQuery DateTime 形式](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_elements_date_time)をご参照ください。

ST_GEOGFROMTEXT

地理関数。

説明

入力された[WKT](https://en.wikipedia.org/wiki/Well-known_text)表現に対応する GEOGRAPHY 値を返します。

詳細については、[ST_GEOGFROMTEXT](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geogfromtext)関数をご参照ください。

SuccessPlaceholder

ST_GEOGFROMTEXT 関数はSnowflakeでサポートされています。

文法構文

 ST_GEOGFROMTEXT(wkt_string[, oriented])
Copy

サンプルソース

ST_GEOGFROMTEXT 関数の指向パラメーターはSnowflakeではサポートされていません。

BigQuery
 SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', TRUE);
Copy
Snowflake
 SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-BQ0006 - ORIENTED PARAMETER IN THE ST_GEOGFROMTEXT FUNCTION IS NOT SUPPORTED IN SNOWFLAKE. ***/!!! 
ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))');
Copy

地理データ型のデフォルトの出力形式は WKT **(Well-Known Text)**であり、Snowflakeでは **WKB (Well-Known Binary)**であることに注意してください。また、WKT形式で表示する場合は、[ST_ASWKT](https://docs.snowflake.com/en/sql-reference/functions/st_aswkt)関数を使用するか、[GEOGRAPHYOUTPUT FORMAT](https://docs.snowflake.com/en/sql-reference/parameters#geography-output-format)形式を設定できます。

ST_GEOGFROMTEXT 関数を使用して地理データを挿入します

この関数は値句では許可されておらず、Snowflakeでは必要ありません。

BigQuery
 CREATE OR REPLACE TABLE test.geographyType
(
  COL1 GEOGRAPHY
);

INSERT INTO test.geographyType VALUES
    (ST_GEOGFROMTEXT('POINT(-122.35 37.55)')), 
    (ST_GEOGFROMTEXT('LINESTRING(-124.20 42.00, -120.01 41.99)'));
Copy
Snowflake
 CREATE OR REPLACE TABLE test.geographyType
(
  COL1 GEOGRAPHY
);

INSERT INTO test.geographyType
VALUES
    (
     --** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
     'POINT(-122.35 37.55)'),
    (
     --** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
     'LINESTRING(-124.20 42.00, -120.01 41.99)');
Copy

ST_GEOGPOINT

地理関数。

説明

単一点を持つ GEOGRAPHY を作成します。 ST_GEOGPOINT は、指定された FLOAT64の 経度(度数法、グリニッジ子午線より西を負、東を正)と緯度(度数法、赤道より北を正、南を負)パラメーターからポイントを作成し、そのポイントを GEOGRAPHY 値として返します。

詳細については、[ST_GEOGPOINT ](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geogpoint)関数をご参照ください。

注釈

関数 ST_GEOGPOINT は、Snowflakeでは ST_POINT に変換されます。

文法構文

 ST_GEOGPOINT(longitude, latitude)
Copy

サンプルソース

BigQuery
 SELECT ST_GEOGPOINT(-122.0838, 37.3860);
Copy
Snowflake
 SELECT ST_POINT(-122.0838, 37.3860);
Copy

地理データ型のデフォルトの出力形式は WKT **(Well-Known Text)**であり、Snowflakeでは **WKB (Well-Known Binary)**であることに注意してください。また、WKT形式で表示する場合は、[ST_ASWKT](https://docs.snowflake.com/en/sql-reference/functions/st_aswkt)関数を使用するか、[GEOGRAPHYOUTPUT FORMAT](https://docs.snowflake.com/en/sql-reference/parameters#geography-output-format)形式を設定できます。

ST_POINT 関数を使用して地理データを挿入します

この関数は値句では許可されておらず、Snowflakeでは必要ありません。

BigQuery
 CREATE OR REPLACE TABLE test.geographyType
(
  COL1 GEOGRAPHY
);

INSERT INTO test.geographyType
VALUES (ST_GEOGPOINT(-122.0838, 37.3860));
Copy
Snowflake
 CREATE OR REPLACE TABLE test.geographyType
(
  COL1 GEOGRAPHY
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "bigquery",  "convertedOn": "04/03/2025",  "domain": "test" }}';

INSERT INTO test.geographyType
VALUES (
--** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
'POINT(122.0838 37.3860)');
Copy

関連 EWI

  1. [SSC-FDM-BQ0010](../../general/technical-documentation/issues-and-troubleshooting/functional-difference/bigqueryFDM.md#ssc-fdm-bq0010):地理機能はSnowflakeでは必要ありません。