Den 2014-02-28 08:42 skrev Svein Erling Tysvær såhär:
>
> Reinventing the wheel can sometimes be fun, Kjell. I would expect this 
> statement
>
> SELECT list('SELECT ''' || TRIM(RDB$RELATION_NAME) ||''' 
> RELATION_NAME, ''' || TRIM(RDB$FIELD_NAME) ||
> ''' FIELD_NAME, COUNT(*) FROM ' || TRIM(RDB$RELATION_NAME) ||
> ' WHERE ' || TRIM(RDB$FIELD_NAME) || '||'''' IS NULL GROUP BY 1, 2 ', '
> UNION ')
> FROM RDB$RELATION_FIELDS
> WHERE RDB$NULL_FLAG = 1
>
> to return an SQL statement that you can execute to find which 
> combination of tables and fields contains NULL values (though it will 
> take time since it has to avoid using indexes, at least I don't think 
> you'll find NULLs if you use indexes).
>

Nice one! Thanks! After fixing some quotes (mixed case table names etc) 
it seems to work nicely. Got 910 "cases"... Will have to split them up I 
think - too many unions otherwise.

Regards,
Kjell

Reply via email to