Re: Re[2]: [firebird-support] select column if it exists

2018-01-02 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
What about: SELECT A, B, COALESCE(C, 'some value here') FROM MyTable Greetings. Walter. On Tue, Oct 10, 2017 at 2:56 PM, 'Daniel Miller' dmil...@amfes.com [firebird-support] wrote: > > > I don't think you could express it in the SELECT directly

Re[2]: [firebird-support] select column if it exists

2017-10-10 Thread 'Daniel Miller' dmil...@amfes.com [firebird-support]
I don't think you could express it in the SELECT directly (someone else will probably build a statement refuting that) but you could do: SELECT r.RDB$FIELD_NAME FROM RDB$RELATION_FIELDS r where r.RDB$RELATION_NAME= and then process that result set to build your appropriate SELECT for the

Re: [firebird-support] select column if it exists

2017-10-09 Thread Elmar Haneke el...@haneke.de [firebird-support]
> Is there a way to include a column in a SELECT but substitute a value if > it doesn't? I need my code to work with different versions of my db schema. > > eg I want to SELECT A, B, C, ... but C might not exist. > > SELECT * would work of course, except it will fetch a bunch of columns I >

[firebird-support] select column if it exists

2017-10-08 Thread Hamish Moffatt ham...@risingsoftware.com [firebird-support]
Is there a way to include a column in a SELECT but substitute a value if it doesn't? I need my code to work with different versions of my db schema. eg I want to SELECT A, B, C, ... but C might not exist. SELECT * would work of course, except it will fetch a bunch of columns I don't need.