Manually Adding a Row to a Resultset
Posted in 2005
Topics: General Discussion
I am querying an Informix database via Sequelink and I want to manually add a row to my recordset. In SQL Server, I would use a UNION clause like this: SELECT Field1 as ValueField ,Field2 as DescField FROM TableA UNION SELECT Null as ValueField ,'All' as DescField Is there similar syntax for Informix? Thanks in advance.
Potter wrote: > I am querying an Informix database via Sequelink and I want to manually > add a > row to my recordset. In SQL Server, I would use a UNION clause like > this: > > > SELECT > Field1 as ValueField > ,Field2 as DescField > FROM TableA > UNION > SELECT > Null as ValueField > ,'All' as DescField You will need to select your fixed values out of a table that actually exists like systables as you can't form a SELECT statement without a FROM clause, e.g. ... UNION SELECT DISTINCT 'All' as DescField from systables. You'll need the DISTINCT otherwise it will return 'All' as many times as there are rows in systables. I'm not sure how you select the null value out though as IDS doesn't seem to like that. Ben.
or you make sure it only returns 1 row from systables
Select NULL as Valuefield, 'All' as DescField
from systables
where tabid = 1
usually should give you the 1 row you require