Subject Re: [firebird-support] select first fails with view
Author Martijn Tonies
> > >>Select first 1 * from sometable works.
> > >>Select first 1 * from v_someview fails:
> >
> > > In the Employee database, PHONE_LIST is a view, and this works fine:
> > >
> > > SELECT FIRST 1 * FROM PHONE_LIST
> >
> >Not quite.
> >Working with an IB_Query (4.2Hf) some statements work, some don't.
> >
> >SELECT FIRST 1 * FROM VIEW ... does NOT work
>
> Oh, that was a pre-Firebird artifact in IBO (4.2Hf came out in June 2002)
> that took "FIRST" to be a column identifier and "1" to be a run-time
alias,
> and would barf when it got to "*". It happened with tables as well as
> views. It was fixed later. So maybe this inquirer is working with a
> pre-Firebird version of EMS Manager as well. EMS Manager uses FIBPlus, I
> think, so the parser in versions since the Firebird 1 release should know
> about SELECT FIRST.
>
> It's pretty unlikely to work if EMS is built with IBX, though, since the
> IBX parser doesn't know about Firebird features at all.
>
> Here's a fun one for you though:
>
> create table blah (
> id integer,
> "FIRST" VARCHAR(10));
> commit;
> insert into blah
> values (1, 'parsnips');
> insert into blah
> values (2, 'turnips');
> insert into blah
> values (3, 'carrots');
> insert into blah
> values (4, 'spinach');
> commit;
>
> select FIRST from blah;
>
> id FIRST
> === ========
> 1 parsnips
> 2 turnips
> 3 carrots
> 4 spinach
>
> select FIRST 2 FIRST from blah;
>
> FIRST
> ========
> parsnips
> turnips
>
> :-) heLen
>

Works fine in Database Workbench :-)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com