Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question MySql database file import problem

    When ever i try to import this file in phpmyadmin it gives an error :
    Code:
    SQL query:
    
    CREATE TABLE `sbprj_additional_info` (
    `sb_id` bigint( 20 ) NOT NULL AUTO_INCREMENT ,
    `sb_project_id` bigint( 20 ) NOT NULL default '-1',
    `sb_description` longtext,
    `sb_temp` timestamp( 14 ) NOT NULL ,
    `sb_posted_on` timestamp( 14 ) NOT NULL ,
    PRIMARY KEY ( `sb_id` )
    ) TYPE = MYISAM ;
    
    MySQL said: Documentation
    #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 '(14) NOT NULL,
      `sb_posted_on` timestamp(14) NOT NULL,
      PRIMARY KEY  (`sb_id' at line 5
    Kindly help me in this matter

    my full mysql code is:
    Code:
    # phpMyAdmin MySQL-Dump
    # version 2.3.2
    # http://www.phpmyadmin.net/ (download page)
    #
    # Host: localhost
    # Generation Time: Oct 13, 2004 at 05:36 PM
    # Server version: 4.00.04
    # PHP Version: 4.2.3
    # Database : `sbprojects`
    # --------------------------------------------------------
    
    #
    # Table structure for table `sbprj_additional_info`
    #
    
    DROP TABLE IF EXISTS `sbprj_additional_info`;
    CREATE TABLE `sbprj_additional_info` (
      `sb_id` bigint(20) NOT NULL auto_increment,
      `sb_project_id` bigint(20) NOT NULL default '-1',
      `sb_description` longtext,
      `sb_temp` timestamp(14) NOT NULL,
      `sb_posted_on` timestamp(14) NOT NULL,
      PRIMARY KEY  (`sb_id`)
    ) TYPE=MyISAM;

  • #2
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts
    no 1 to help ??????????

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,028
    Thanks
    75
    Thanked 4,325 Times in 4,291 Posts
    You know, you really don't need those (14), et al., in there.

    And TYPE=MYISAM is wrong.

    And it's better to use DATETIME instead of TIMESTAMP.

    Try something really simple:
    Code:
    DROP TABLE IF EXISTS sbprj_additional_info;
    
    CREATE TABLE sbprj_additional_info (
      sb_id bigint NOT NULL auto_increment PRIMARY KEY,
      sb_project_id bigint NOT NULL default -1,
      sb_description longtext,
      sb_temp datetime NOT NULL,
      sb_posted_on datetime NOT NULL
    ) Engine=MyISAM;
    That works. Tested it.

    UPDATE: I checked your attempt: It simply doesn't like the (14) after timestamp. If you omit the two (14) and change TYPE to Engine then yours works.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Tags for this Thread

    Posting Permissions

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