Subject Re: [ib-support] FB 1 and INSERT INTO
Author Helen Borrie
At 11:38 AM 13-03-02 +0100, Lucas Franzen wrote:

>Until now it was legal to have statements like:
>
>INSERT INTO MYTABLE ( MYTABLE.MY_ID, MYTABLE.MY_INTEGER )
>VALUES ( 1, 2 );
>
>Now this won't work unless I omit the MYTABLE in front of the
>fieldnames.
>
>Unfortunately the table name is added automatically by (for example)
>IBO...

No, Luc, I don't think so! Here is IBO monitor output:

/*---
ALLOCATE STATEMENT
DB_HANDLE = 15420648
STMT_HANDLE = 15418824

SECONDS = 0.010
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 15414556
STMT_HANDLE = 15418824

insert into inv_header(id,field1,field2)
values(? /* id */ ,? /* field1 */ , ? /* field2 */ )

FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
----*/
/*===
//>>> STATEMENT PREPARED <<<//
TIB_Statement.API_Prepare()
TIB_DSQL: "frmSQL.dsqlEdit" stHandle=15418824
====*/
/*---
DESCRIBE INPUT
STMT_HANDLE = 15418824
PARAMS = [ Version 1 SQLd 3 SQLn 3
< SQLType: 496 SQLLen: 4 > = <NIL>
< SQLType: 449 SQLLen: 20 > = <NIL>
< SQLType: 449 SQLLen: 20 > = <NIL> ]
----*/
/*---
STATEMENT INFO
STMT_HANDLE = 15418824
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 15414556
STMT_HANDLE = 15418824
PARAMS = [ Version 1 SQLd 3 SQLn 3
[ID] = 0
[FIELD1] = 'comment1'
[FIELD2] = 'narcissi' ]

INSERT COUNT: 1
----*/
/*---
COMMIT
TR_HANDLE = 15414556

SECONDS = 0.010
----*/
and FB 1 certainly rejects this:

insert into inv_header(inv_header.id,
inv_header.field1,
inv_header.field2)
values(:id,:field1, :field2)

ISC ERROR CODE:335544569

ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 34
.

fwiw, I don't recall it *ever* being valid syntax to include the table
identifier in the column list of an INSERT statement...

regards,
Helen

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________