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
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.
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
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.
Yeh! I googled the error and found it useful. Thanks
ReplyDelete