Press "Enter" to skip to content

Resulting Data Types from a UNION Operation

Andy Brownsword puts on the lab coat and performs some experiments:

The UNION and UNION ALL operators allow us to combine results, but there’s no guarantee that each set of results uses the same data types. So what data types are returned?

For the longest time I thought the data types from the first set of results were used for the final results. That’s not the case.

Read on to see what the rules look like.