I need to find rows in resultsets that have every column without null.
These result sets got variable number of columns.
Currently, the only way that I can think of is creating a view on each result set and filter this way:
select field1, field2, field3, field4, ...
from "huge query"
where field1 is not null and
field2 is not null and
field3 is not null and
field4 is not null and
... is not null
is there a better way to do this in a stored procedure/function in SQL Server or in .net code (c# or vb.net) ?
And what about doing something like
select field1, field2, field3, field4, ...
from "huge query"
(return to .net apps or insert into #temptable)
and then in a stored procedure/function or .net code(c# / vb.net) loop through all rows / columns and flag or remove every row that got any null?
I’m talking about easily over 50 different kind of resultsets and it might grow over time, so I’m looking for a generic / easily maintainable way
Since nulls propagate, if they’re all the same datatype, try
If they’re not, then convert them all (the ones that are not already a string) to char first, and then concatenate them.