Professional Web Applications Themes

MySQL Error in SQL Statement - MySQL

Hi All, I have this create table statement: CREATE TABLE jos_acajoom_stats_details ( listid int(10) NOT NULL default '0', mailing_id int(11) NOT NULL default '0', subscriber_id int(11) NOT NULL default '0', sentdate datetime NOT NULL default '0000-00-00 00:00:00', html tinyint(1) NOT NULL default '0', read tinyint(1) NOT NULL default '0', UNIQUE KEY listid (listid,mailing_id,subscriber_id) ) TYPE=MyISAM; I get this error message: ERROR 1064 (42000): 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 'read tinyint(1) NOT NULL default '0', UNIQUE KEY listid (listid,mailing_id,sub' at line ...

  1. #1

    Default MySQL Error in SQL Statement

    Hi All,

    I have this create table statement:

    CREATE TABLE jos_acajoom_stats_details (
    listid int(10) NOT NULL default '0',
    mailing_id int(11) NOT NULL default '0',
    subscriber_id int(11) NOT NULL default '0',
    sentdate datetime NOT NULL default '0000-00-00 00:00:00',
    html tinyint(1) NOT NULL default '0',
    read tinyint(1) NOT NULL default '0',
    UNIQUE KEY listid (listid,mailing_id,subscriber_id)
    ) TYPE=MyISAM;


    I get this error message:

    ERROR 1064 (42000): 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 'read tinyint(1) NOT NULL default '0',
    UNIQUE KEY listid (listid,mailing_id,sub' at line 7

    Can anyone help me with what the issue is? This came from a file that
    was put out by a MySQLdump, so the file has not been modified......

    Thanks!

    amerar@iwc.net Guest

  2. #2

    Default Re: MySQL Error in SQL Statement


    Hmmm...found the answer. Looks like the application created some
    tables with reserved words.

    STUPID!!!

    Anyhow, I wonder how I can get MySQLdump to back tick the reserved
    words......

    amerar@iwc.net Guest

  3. #3

    Default Re: MySQL Error in SQL Statement

    On 16 Nov 2006 08:12:48 -0800, net wrote: 

    "read" is reserved. Try

    CREATE TABLE jos_acajoom_stats_details (
    listid int(10) NOT NULL default '0',
    mailing_id int(11) NOT NULL default '0',
    subscriber_id int(11) NOT NULL default '0',
    sentdate datetime NOT NULL default '0000-00-00 00:00:00',
    html tinyint(1) NOT NULL default '0',
    my_read tinyint(1) NOT NULL default '0',
    UNIQUE KEY listid (listid,mailing_id,subscriber_id)
    ) TYPE=MyISAM;

    --
    "The last refuge of the insomniac is a sense of superiority to the
    sleeping world."
    --Leonard Cohen, The Favourite Game
    Peter Guest

  4. #4

    Default Re: MySQL Error in SQL Statement

    On 16 Nov 2006 08:29:50 -0800, net wrote: 

    It's just a text file... s/ read / `read` /g

    --
    I once successfully declined a departmental retreat, saying that on
    that day I planned instead to advance.
    -- Alan J. Rosenthal
    Peter Guest

  5. #5

    Default Re: MySQL Error in SQL Statement

    "net" <net> wrote: 

    mysqldump --quote-names

    better: read mysqldump --help and pick what suits you


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

Similar Threads

  1. Replies: 0
    Last Post: January 29th, 02:03 PM
  2. php+mysql statement timing out
    By Shabam in forum PHP Development
    Replies: 6
    Last Post: March 2nd, 07:23 AM
  3. insert statement into a mySQL dB from PHP
    By K in forum PHP Development
    Replies: 2
    Last Post: November 23rd, 04:19 PM
  4. PHP and MySQL WHERE statement
    By Cowfisher in forum PHP Development
    Replies: 3
    Last Post: July 6th, 08:02 AM
  5. Statement Conversion Access -> mySQL
    By ryanb006 in forum ASP Database
    Replies: 2
    Last Post: July 3rd, 06:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139