I am trying to help an employee with a specific problem, and it is limited only to MS SQL QUERY code. The object is to insert a dummy record (in the surrounding union) if no records are returned from the query.
It is difficult for me to move from PL / SQL to MS SQL, and I seek help (I am not particularly attractive, but I appeal to the StackOverflow audience).
Basically, we need one test value from the target Select statement ...
In theory, this would do this:
(other records from unions)
Union
Select "These" as fld1, "are" as fld2, "Dummy" as fld3, "Fields" as fld4
where NOT (Matching Logic)
Union
Select fld1, fld2, fld3, fld4 // Regular records exist
From tested_table
Where (Matching Logic)
Setting a separate dummy recording without any conditions.
Is there a way to get one testable result from Select?
Unable to do this in code (not allowed), but can feed SQL
Is anyone Is anyone Bbeller?
source
share