Subject Re: SELECT INTO TABLE
Author Adam
--- In firebird-support@yahoogroups.com, Vlad Orlovsky
<vlad.orlovsky@...> wrote:
>
> Hi Set,
>
> I'm trying this in SQL Editor window in IB Expert:
>
> insert into USERS2(USER_ID, USER_ROLE_ID,USER_NAME)
> select USER_ID, USER_ROLE_ID,USER_NAME from USER;
>
> I'm getting:
>
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 2, column 45.
> USER.
>
> Is the syntax for 2.0 slightly different?
>
> I'm using an embedded version(if that makes any difference).
>

Vlad,

I have not checked, but user does smell suspiciously like one that may
be a reserved word.

Here is a script that should prove that the syntax works:

---
CREATE TABLE FOO (A INTEGER);
CREATE TABLE BAR (A INTEGER);
COMMIT;

INSERT INTO FOO (A) VALUES (1);
INSERT INTO FOO (A) VALUES (2);
COMMIT;

INSERT INTO BAR (A) SELECT A FROM FOO;
COMMIT;

SELECT * FROM BAR;
COMMIT;

DROP TABLE FOO;
DROP TABLE BAR;
COMMIT;
---

Adam