Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003

    Unanswered: Create Table with LIKE SyntaxProblem

    Hi Guys,

    I have a very simple problem with my syntax but I cant work it out...
    I want to cretate a table with the same structure as an existing table. In the MySQL manual it defines the syntax:

    CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (LIKE old_table_name);

    However when I try to create my table
    CREATE TABLE accidentsample (LIKE accident);

    or various combinations such as ->
    CREATE TABLE accidentsample LIKE accident;

    I get the error:

    ERROR 1064: 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 'like accident)' at line 1

    Wich I presume is a systatic parser error getting confused with 'LIKE' (Maybe because of the regex like command?)

    Abyway, this should be really simple.. has anyone got this command to work, and if so can Iplease see the exact syntax?

    Thanks a lot for your time!


    | version() |
    | 4.0.13-nt |
    PS: MYSQL version =

  2. #2
    Join Date
    Jul 2003

    Only works in MySQL version 4.1+.


  3. #3
    Join Date
    May 2003
    Yo Ash...

    Aye I as wonderin if it was something like that... Hence version number inclusion...

    Cheers for you help! You saved me loads of time!


Posting Permissions

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