SQL Basics – What are Row Constructors?

Constructors, as the name suggests means to create an instance of an Object in any Object Oriented Programming language.

Here in SQL Server or T-SQL, ROW Constructor or Table Value Constructor means to create a row set by using the VALUES() clause. This allows multiple rows of data to be specified in a single DML statement. And this VALUES() clause can be used with the SELECT, INSERT and MERGE statements.

In the examples below we will see how they can be used and are helpful at times:

Usage #1. You can create a simple set of rows with a SELECT FROM statement:

Thus, Row Constructors or Table Value Constructors are very handy when dealing with fixed set of row sets used for temporary purpose, without need of creating and storing them in #Temp-Tables or Table-Variables.