LoginSignup
1
1

More than 3 years have passed since last update.

SQL Server 2019では行値式が利用できない

Posted at

SQL Server 2019では行値式(row value constructor)が利用できないようです。

具体的には以下のようなSQLがSyntax Errorになります。

SELECT *
FROM t
WHERE (col1, col2) IN (('A', 1), ('B', 2));

行値式はベンダー依存の文法ではなく、標準SQL(SQL92)に定められた文法です。その証左としてPostgres13とMySQL8およびOracle Databse 19cで上記のSQLが動作することを確認できました。

Microsoftが用意しているSQL ServerのFeedback forumを見たところ、「行値式をサポートしてほしい」というトピックが2007年ごろにたてられていますが、2021年3月3日現在、UNPLANEDタグが付けられており、少なくとも現時点では行値式がサポート外であることは間違いなさそうです。

なお行値式がサポート外であることをSQL Serverのリファレンスから見つけることはできませんでした。

環境情報

  • Microsoft SQL Server 2019 (RTM-CU9) (KB5000642) - 15.0.4102.2 (X64) Jan 25 2021 20:16:12 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 18.04.5 LTS)
  • PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
  • mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
  • Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.3.0.0.0
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1