Name for SELECT * FROM (VALUES (x, y)) AS TableLiteral (Col1, Col2)

The following is the syntax of SQL:

SELECT * FROM (VALUES ('p','q'),('x','y')) AS TableLiteral(Col1, Col2) 

and returns the table:

  | Col1 | Col2 ---------------- 1 | p | q 2 | x | y 

This syntax can also be used in CTE, etc.

Is there a name for this? I call them TableLiterals by analogy with string literals and regular expression literals.

Is there a term that will be widely recognized.

+7
terminology sql-server tsql
source share
2 answers

It is called: Table Value Constructor

Defines a set of expressions for row values ​​to be constructed in a table. The Transact-SQL Table Value Designer allows you to specify multiple rows of data in a single DML statement. The table value constructor can be specified in the VALUES clause of the INSERT statement, in the USING clause of the MERGE statement, and in the definition of the view in the FROM clause.

VALUES () [, ... n]

Additional information about the ANSI standard: F641, row and table constructors and select without .

+6
source share
+2
source share

All Articles