The number of columns for each row in a table value constructor must be the same

What is table value constructor?

A set of row value expressions to be constructed into a table.

It can be specified/Used in the following forms
  • VALUE Clause in INSERT
  • VALUE Clause in SELECT..FROM
  • VALUE Clause in MERGE..USING
  • VALUE Clause in JOIN
The number of values specified in each list must be the same and the values must be in the same order as the columns in the table.

Usually, We need to use UNION or UNION ALL for Non-Table result set. Right ?



But, The same thing can be achieved by Table value constructor as below 


And, The number of values specified in each list should be matching!! 

If not - We can see the below Error






Msg 10709, Level 16, State 1, Line 1
The number of columns for each row in a table value constructor must be the same.

1 comment: