Reputation: 185
I have two tables which I have a 'union all' between.
My issue, I get a data mismatch error cause, in Table one I have select ... ,'opt' as opt from...
Then in the second table I have select ..., null as opt from...
I know that I could have an empty string with '' as opt
however, I don't want an empty string, I really do need it to be null. Is there anyway I can get the query to accept the null?
Upvotes: 2
Views: 7357
Reputation: 60462
The parser internally assigns a datatype to a NULL and it's an INTEGER. Your column is not numeric thus resulting in s a type mismatch.
To solve this simply CAST(NULL AS VARCHAR(..))
Upvotes: 8