Is it possible to join tables, when one or more tables does not even exist?
Consider this use case: You are using some system that has a certain DB scheme out of the box, but allows you to create your own custom tables as well.
It is possible to run a query of some kind that includes custom tables, but will also run without errors for someone who does not have these custom tables set up?
Or what is the most elegant way to achieve this without having to maintain different versions of your queries?
edit: especially for Sybase ASE, but I am also interested in other dbms.
You could do something like this:
IF EXISTS (Select * from sysobjects where name = 'tblname')
Begin
Select *
from tbl
End
Else
Begin
--Do something else
End
Basically check the table exists and run the query if it does, if it doesn't then do something else.