Subject Re: [firebird-support] Newbie Question: Is Firebird SQL really this weird or am I missing something?
Author Nick Upson
Only case-sensitive names or where you are using a reserved word need to be
quoted.

SQL> create database "test.gdb";
SQL> create table test
CON> (
CON> id integer not null,
CON> name varchar(255),
CON> constraint PK_TEST primary key (id)
CON> );

the above should work fine

SQL> show tables;
test

you need a commit before doing an insert

SQL> insert into test (id, name) values (1,"Item1");

this works fine as is, if you do use quoted variables you have to use them
all the time, in this case your table used a field called "name" and the
insert should have referred to that as well

In article <3F0F31F9.9020901@...>, Ian Berthon wrote:
> I'm new to the list and new to Firebird. I'm evaluating Firebird 1.0.3
> to use in a number of C++ and Java projects that I'm working on and I
> *must* be doing something wrong. Below is a cut'n'paste of my session in
> isql...
>
> SQL> create database "test.gdb";
> SQL> create table "test"
> CON> (
> CON> "id" integer not null,
> CON> "name" varchar(255),
> CON> constraint "PK_TEST" primary key ("id")
> CON> );
> SQL> show tables;
> test
> SQL> insert into test (id, name) values (1,"Item1");
> Statement failed, SQLCODE = -206
> Dynamic SQL Error
> -SQL error code = -206
> -Column unknown
> -Item1
> -At line 1, column 23.
> SQL> [Lots of variations of the above snipped]
> SQL> insert into "test" ("id", "name") values (1,'Item1');
> SQL> select * from test;
> Statement failed, SQLCODE = -204
> Dynamic SQL Error
> -SQL error code = -204
> -Table unknown
> -TEST
> -At line 1, column 15.
> SQL> select * from "test";
>
> id name
> ============
> ===============================================================================
> 1 Item1
>
> What I don't understand is why everything needs to be quoted (I thought
> only keywords need to be quoted in ANSI SQL?). What I was hoping to be
> able to do is to have my code working without any major modification on
> either a Firebird or MySQL server (I know I'm going to have to do
> something in order to handle things like AutoNumber/Generators but I was
> hoping I wouldn't need to duplicate all of the SQL) Will somebody please
> tell me what I'm doing wrong?
>

--
Nick
-----We Solve your Computer Problems---
Founder & Listowner of the Prolifics User Group
Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly