Create table syntax?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J West

    Create table syntax?

    Warning: Error while executing this query:CREATE TABLE "purchaseor der" (
    "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
    "PurchaseCo st" double unsigned zerofill NOT NULL default
    '00000000000000 00000000',
    "PurchaseDescri ption" varchar(255) character set latin1 collate latin1_bin
    NOT NULL default '',
    "PurchaseeBayRe ference" varchar(45) default NULL,
    "PurchaseNo tes" varchar(255) NOT NULL default '',
    "PurchasePictur e" mediumblob NOT NULL,
    "PurchaseQuanti ty" int(10) unsigned NOT NULL default '0',
    "PurchaseOrderI nvoiceID" int(10) unsigned NOT NULL default '0',
    "PurchaseDa te" datetime NOT NULL default '2004-01-01 00:00:00',
    "PurchaseOrderC urrencySymbol" varchar(4) NOT NULL default '£',
    "PurchasePostag e" double NOT NULL default '0',
    PRIMARY KEY ("PurchaseOrder ID"),
    UNIQUE KEY "idx_eBayRe f" ("PurchaseeBayR eference"),
    KEY "FK_purchaseord er_1" ("PurchaseOrder InvoiceID"),
    CONSTRAINT "purchaseorder_ ibfk_3" FOREIGN KEY ("PurchaseOrder InvoiceID")
    REFERENCES "purchaseorderi nvoice" ("PurchaseOrder InvoiceID")
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 11264 kB;
    (`SupplierID`) REFER `purpleflavours/';
    The server has returned this error message:You have an error in your SQL
    syntax; check the manual that corresponds to your MySQL server version for
    the right syntax to use near '"purchaseorder " (
    "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
    ' at line 1

    Can anyone explain what I am doing wrong here please!

    Thanks

    James West


  • Randell D.

    #2
    Re: Create table syntax?

    J West wrote:
    [color=blue]
    > Warning: Error while executing this query:CREATE TABLE "purchaseor der" (
    > "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
    > "PurchaseCo st" double unsigned zerofill NOT NULL default
    > '00000000000000 00000000',
    > "PurchaseDescri ption" varchar(255) character set latin1 collate latin1_bin
    > NOT NULL default '',
    > "PurchaseeBayRe ference" varchar(45) default NULL,
    > "PurchaseNo tes" varchar(255) NOT NULL default '',
    > "PurchasePictur e" mediumblob NOT NULL,
    > "PurchaseQuanti ty" int(10) unsigned NOT NULL default '0',
    > "PurchaseOrderI nvoiceID" int(10) unsigned NOT NULL default '0',
    > "PurchaseDa te" datetime NOT NULL default '2004-01-01 00:00:00',
    > "PurchaseOrderC urrencySymbol" varchar(4) NOT NULL default '£',
    > "PurchasePostag e" double NOT NULL default '0',
    > PRIMARY KEY ("PurchaseOrder ID"),
    > UNIQUE KEY "idx_eBayRe f" ("PurchaseeBayR eference"),
    > KEY "FK_purchaseord er_1" ("PurchaseOrder InvoiceID"),
    > CONSTRAINT "purchaseorder_ ibfk_3" FOREIGN KEY ("PurchaseOrder InvoiceID")
    > REFERENCES "purchaseorderi nvoice" ("PurchaseOrder InvoiceID")
    > ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 11264 kB;
    > (`SupplierID`) REFER `purpleflavours/';
    > The server has returned this error message:You have an error in your SQL
    > syntax; check the manual that corresponds to your MySQL server version for
    > the right syntax to use near '"purchaseorder " (
    > "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
    > ' at line 1
    >
    > Can anyone explain what I am doing wrong here please!
    >
    > Thanks
    >
    > James West
    >
    >[/color]

    I'm just pulling at straws here as I've been unable to test it - However
    you use a hook instead of an apostraphe after your REFER... and why
    escape it?

    Thus why the following:

    REFER 'purpleflavours/';

    Why not:
    REFER 'purpleflavours/';

    I also think that you have an imbalance of ( though I cannot find
    where... I've got about a years MySQL behind me - little of it in a work
    environment, so I could well be wrong... however I believe the correct
    syntax for CREATE TABLE is

    CREATE TABLE "tablename"
    (
    cell structure....
    PRIMARY KEY...
    );

    You have an open bracket after your table name - but I cannot find where
    it is closed...

    I hope something above helps you in the right direction...
    randelld

    Comment

    • J West

      #3
      Re: Create table syntax?

      Thanks for that ! The SQL was automatically generated by MySQL Administrator
      as part of a restore from a backup! I have not included the whole syntax as
      it is 64 MB!!!!!

      I have only been using MySQL for three weeks and it's lack of stability is
      doing my head in!
      I think I'll go back to using MSSQL for the time being until the tools
      mature a little more!

      Regards

      James West

      "Randell D." <reply.via.news .group.only.tha nks@fiprojects. moc> wrote in
      message news:GtbRd.4163 88$Xk.274429@pd 7tw3no...[color=blue]
      >J West wrote:
      >[color=green]
      >> Warning: Error while executing this query:CREATE TABLE "purchaseor der" (
      >> "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
      >> "PurchaseCo st" double unsigned zerofill NOT NULL default
      >> '00000000000000 00000000',
      >> "PurchaseDescri ption" varchar(255) character set latin1 collate
      >> latin1_bin NOT NULL default '',
      >> "PurchaseeBayRe ference" varchar(45) default NULL,
      >> "PurchaseNo tes" varchar(255) NOT NULL default '',
      >> "PurchasePictur e" mediumblob NOT NULL,
      >> "PurchaseQuanti ty" int(10) unsigned NOT NULL default '0',
      >> "PurchaseOrderI nvoiceID" int(10) unsigned NOT NULL default '0',
      >> "PurchaseDa te" datetime NOT NULL default '2004-01-01 00:00:00',
      >> "PurchaseOrderC urrencySymbol" varchar(4) NOT NULL default '£',
      >> "PurchasePostag e" double NOT NULL default '0',
      >> PRIMARY KEY ("PurchaseOrder ID"),
      >> UNIQUE KEY "idx_eBayRe f" ("PurchaseeBayR eference"),
      >> KEY "FK_purchaseord er_1" ("PurchaseOrder InvoiceID"),
      >> CONSTRAINT "purchaseorder_ ibfk_3" FOREIGN KEY
      >> ("PurchaseOrder InvoiceID") REFERENCES "purchaseorderi nvoice"
      >> ("PurchaseOrder InvoiceID")
      >> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 11264 kB;
      >> (`SupplierID`) REFER `purpleflavours/';
      >> The server has returned this error message:You have an error in your SQL
      >> syntax; check the manual that corresponds to your MySQL server version
      >> for the right syntax to use near '"purchaseorder " (
      >> "PurchaseOrderI D" int(10) unsigned NOT NULL auto_increment,
      >> ' at line 1
      >>
      >> Can anyone explain what I am doing wrong here please!
      >>
      >> Thanks
      >>
      >> James West[/color]
      >
      > I'm just pulling at straws here as I've been unable to test it - However
      > you use a hook instead of an apostraphe after your REFER... and why escape
      > it?
      >
      > Thus why the following:
      >
      > REFER 'purpleflavours/';
      >
      > Why not:
      > REFER 'purpleflavours/';
      >
      > I also think that you have an imbalance of ( though I cannot find where...
      > I've got about a years MySQL behind me - little of it in a work
      > environment, so I could well be wrong... however I believe the correct
      > syntax for CREATE TABLE is
      >
      > CREATE TABLE "tablename"
      > (
      > cell structure....
      > PRIMARY KEY...
      > );
      >
      > You have an open bracket after your table name - but I cannot find where
      > it is closed...
      >
      > I hope something above helps you in the right direction...
      > randelld[/color]


      Comment

      • Randell D.

        #4
        Re: Create table syntax?

        J West wrote:
        [color=blue]
        > Thanks for that ! The SQL was automatically generated by MySQL Administrator
        > as part of a restore from a backup! I have not included the whole syntax as
        > it is 64 MB!!!!!
        >
        > I have only been using MySQL for three weeks and it's lack of stability is
        > doing my head in!
        > I think I'll go back to using MSSQL for the time being until the tools
        > mature a little more!
        >
        > Regards
        >
        > James West
        >[/color]

        I can't say I know MySQL well enough to argue your points, but honestly,
        I think you should stick with MySQL - I don't think its a stability
        issue (though maybe it is on a windows environment). I've seen it (no
        never administered it) in use from v3 running databases with several
        hundred thousands of records and it works fine and dandy. In addition,
        I believe independant tests comparing like for like features with an
        Oracle database makes MySQL win hands down... others might flame me on
        this because Oracle contains additional features not (yet?) found in
        MySQL that makes chewing data better... but if you were to compare
        exactly like for like, MySQL is a damned fine piece of work...

        anyway...

        hope you find the bug in your earlier query - and thanks for the earlier
        join help...

        randelld

        Comment

        Working...