Subject | Re: could not find UNIQUE INDEX with specified columns |
---|---|
Author | troller507 |
Post date | 2008-10-16T12:04:29Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
*always* have to refer to it with quoted identifiers - hence your
REFERENCES clause is wrong. Tip - don't use quoted identifiers unless
you really HAVE to for some absurd reason. There are lots more fun
things to die for. ;-)
Thank you very much!
An other question, do you know a fast way to import huge xml data
(recursive level < 20) into firebird (using c#)?
Regards
Joe
>quoted identifiers. Because you did that, you made it so that you
> At 21:27 16/10/2008, you wrote:
> >--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@> wrote:
> >>
> >> At 20:30 16/10/2008, you wrote:
> >>
> >> > FbConnection c = new
> >>
>
>>FbConnection("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=mydb.fdb");
> >> >
> >> > c.Open();
> >> > FbTransaction t = c.BeginTransaction();
> >> > FbCommand cmd = new FbCommand("CREATE TABLE \"test\"
> >> >(field1 integer, field2 char(1024), field3 integer, PRIMARY KEY
> >> >(field1))", c, t);
> >> > cmd.ExecuteNonQuery();
> >> > t.Commit();
> >> > t.Dispose();
> >> > t = c.BeginTransaction();
> >> > FbCommand cmd1 = new FbCommand("ALTER TABLE \"test\" ADD
> >> >FOREIGN KEY (field3) REFERENCES test(field1)", c, t);
> >> > cmd1.ExecuteNonQuery();
> >> > t.Commit();
> >> > t.Dispose();
> >> > c.Close();
> >> >
> >> >Throws Unhandled Exception: FirebirdSql.Data.Firebird.FbException:
> >> >unsuccessful metadat a update could not find UNIQUE INDEX with
> >> >specified columns
> >>
> >> Well, the problem there is that your CREATE TABLE statement has
> >failed because you can't apply a PK to a nullable column. You need to
> >make that column NOT NULL.
> >>
> >> ./helen
> >>
> >
> >Hi
> >
> > FbConnection c = new
>
>FbConnection("ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=mydb.fdb");
> >
> > c.Open();
> > FbTransaction t = c.BeginTransaction();
> > FbCommand cmd = new FbCommand("CREATE TABLE \"test\"
> >(field1 integer not null, field2 char(1024), field3 integer, PRIMARY
> >KEY (field1))", c, t);
> > cmd.ExecuteNonQuery();
> > t.Commit();
> > t.Dispose();
> > t = c.BeginTransaction();
> > FbCommand cmd1 = new FbCommand("ALTER TABLE \"test\" ADD
> >FOREIGN KEY (field3) REFERENCES test(field1)", c, t);
> > cmd1.ExecuteNonQuery();
> > t.Commit();
> > t.Dispose();
> > c.Close();
> >
> >Exactly the same problem!
>
> Oh! what I didn't notice was that you had created the table in
*always* have to refer to it with quoted identifiers - hence your
REFERENCES clause is wrong. Tip - don't use quoted identifiers unless
you really HAVE to for some absurd reason. There are lots more fun
things to die for. ;-)
>Hi
> ./heLen
>
Thank you very much!
An other question, do you know a fast way to import huge xml data
(recursive level < 20) into firebird (using c#)?
Regards
Joe