Union query 2616 error

Database

Union query 2616 error

select 127 from customer
union
select 131 from customer

The above query generates the subject mentioned the qorkaround is typecast the value 127 to Integer. the reason for the error is the value 127 is considered as Byte and 131 as Integer and the query optimizer tries to convert 131 to Byte, so it gives the subject mentioned error.

Is this the only solution?

Thanks,
1 REPLY

Re: Union query 2616 error


Make them the same type..

sel cast(127 as Integer) from customer
union
sel cast(131 as Integer) from customer;