I have two temporary tables, say #t1 and #t2 in Sql Server 2008. I need to create #t3 such as:
- when
#t1has rows, indifferently of#t2's contents,#t3=select * from #t1 - when
#t1has no rows,#t3=select * from #t2
we can assume #t1 and #t2 have the same columns but I don't think I would like to rely on that fact.
I was thinking of something that draws some logic out of 'if exists (select * ...)' statements, but wouldn't there be better like some sort of bool operators ?