RE: Getting the database name of a given table?
Posted in 2010
Hmmm.
Have you tried update statistics?
Sorry, I couldn't resist.
Think about what you're doing. You're pulling data in to a single table so how do you differentiate where the data came from?
How about something like:
SELECT "DB1", some_cols FROM DB1:atable
UNION
SELECT "DB3",some_cols
FROM DB3:atable
UNION
SELECT "DB4", some_cols FROM DB4:atable
So that your first column in your result set is going to be "Source".
Naw that would be too simple, right?
Also note that there is no "DB2" label. Why? Cause that's an insult to IDS. ;-)
But hey! What do I know?
-G
> From: david.heydon@LangdonSystems.com
> To: informix-list@iiug.org
> Subject: Getting the database name of a given table?
> Date: Fri, 19 Mar 2010 11:40:05 +0000
>
> Hi All.
>
> If I have a piece of SQL like:-
>
> SELECT some_cols FROM DB1:atable UNION
> SELECT some_cols FROM DB2:atable UNION
> SELECT some_cols FROM DB3:atable>
> How can I also return as a column the database the row matches so I can
> differentiate between DB1, DB2 and DB3 in the above example?
>
> I've tried a few things but no success so far. Any inspiration appreciated!
>
> TIA.
>
> David
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_3