Subject Re: [firebird-support] Unable to INSERT INTO TABLE
Author Dmitry Kuzmenko
Hello, Allstars!

Wednesday, May 15, 2013, 9:42:24 PM, you wrote:

A> I am fairly new to FIREBIRD SQL. I am using WINSQL as my database management system.

as I see, WINSQL does not support InterBase or Firebird directly, so,
you work through ODBC, which is not good.

A> It creates the table and says (0) rows affected.

have you created table by provided SQL statement, or used some kind
of wizard, like "enter table name, add field, ..."?

A> Fine. I look at
A> the database explorer and the table is there.

have you tried to insert data into this table? Just 1 record?

A> When i try to insert into the table, it says that the table is
A> unknown.

you need to check the name of the table. As I asked before,
when you enter

create table allBillOfMaterials(...

Firebird translates table name to uppercase and then you will see
ALLBILLOFMATERIALS, not allBillOfMaterials in the DB.

If you see allBillOfMaterials, then you created table by wizard
(or something), and it used name as

create table "allBillOfMaterials"(...

If yes, allBillOfMaterials <> "allBillOfMaterials".
If name have mix of upper and lower characters, you MUST doublequote
it. If you will make mistake in case of any symbol, server will
say that "table is unknown".

I suggest you to drop this table and create it again, as
create table ... as you wrote in your question.
FB will convert names to uppercase, and you will never have that
case sEnSiTiViTy problem.

A> The id(pk) should be created automatically I'm thinking.

Nope. Firebird does not have autoicrement fields. PK is not an
autoincrement. You need to create trigger to fill PK with the
generator (sequence), if you do not pass PK value into insert
statement.

A> insert into allBillOfMaterials('', totalTitles, bomNumber, bomDescription)
A> select distinct
A> count(bom.num) as "Total"
A> ,bom.num as "BOM Number"
A> ,bom.description as "BOM Description"
A> from bom
A> inner join bomitem on bomitem.bomid = bom.id
A> inner join part on part.id = bomitem.partid
A> inner join bomitemtype on bomitemtype.id = bomitem.typeid
A> inner join customset on customset.recordid = part.id
A> where bomitem.typeid = 20
A> and customset.info = 'Book'
A> group by bom.num, bom.description
A> order by bom.description




A> ------------------------------------

A> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

A> Visit http://www.firebirdsql.org and click the Resources item
A> on the main (top) menu. Try Knowledgebase and FAQ links !

A> Also search the knowledgebases at http://www.ibphoenix.com

A> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A> Yahoo! Groups Links






--
Dmitry Kuzmenko, www.ib-aid.com