coalesce in IQ is not working

497 Views Asked by At

I am using something like this:

select @x=coalesce(@x,'')+col1 from testdatatable

This works perfectly on SQL Server 2008 but for IQ it fails:

SELECT returns more than one row

1

There are 1 best solutions below

3
On

We need more information on what your goal is here.

Is your select statement returning multiple rows? If so, IQ is attempting to set a single (varchar?) variable, @x, with many values...which isn't possible. It doesn't look like coalesce is your problem to me.

If are you trying get a single row back from testdatatable, and concatenate that single row's col1 with the @x, why not

select
  @x = isnull(@x, '') + col1
from testdatatable
where (clause to get single row)