Results 1 to 3 of 3
  1. #1
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Default Error in table creation

    I have trying to create a MySQL database table as:

    Java Code:
    CREATE TABLE `tolltaxsystem1.2`.`vehicle`( 
       `vehicle_type` ENUM('LMV','LCV','BUS','TRUCK','MAV') NOT NULL , 
       `vehicle_num` VARCHAR(12) NOT NULL , 
       `journey` ENUM('SJ','CR','EX') NOT NULL , 
       `exempted_type` VARCHAR(4) NOT NULL DEFAULT 'NA' , 
       `material` ENUM('O','ME','MG','AG') NOT NULL DEFAULT 'O' , 
       `amount` DOUBLE(5,2) NOT NULL DEFAULT '0.0' , 
       `booth_num` ENUM('1','2','3','4','5','6','7','8','9') NOT NULL , 
       `lane_num` TINYINT NOT NULL DEFAULT '0' , 
       `passed_at` DATETIME NOT NULL DEFAULT NOW(),
       `image` BLOB 
       
     )
    But it shows me a error that :

    Java Code:
    Error Code : 1067
    Invalid default value for 'passed_at'
    Please guide me how to remove this error, as i want to store current date and time in the column with every new row insertion with NOW() function..........

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

  3. #3
    asifzbaig is offline Member
    Join Date
    May 2011
    Posts
    56
    Rep Power
    0

    Default

    Have you read the MySQL documentation?
    MySQL :: MySQL 5.6 Reference Manual :: 10.1.4 Data Type Default Values
    Thanks very much..that things are sometimes difficult to explore on web..

    Do me one more favor please, if i want to create a trigger or anything like this that can reset my autoincrement values to zero again with the change in date?
    How can i accomplish this?

Similar Threads

  1. Java and minecraft server creation error
    By Vaart in forum Networking
    Replies: 2
    Last Post: 06-09-2011, 05:24 PM
  2. "Access is denied" error while file creation
    By Bharath_M in forum Advanced Java
    Replies: 4
    Last Post: 04-10-2011, 12:23 PM
  3. Error in JFrame creation...help asap
    By bluejamesbond in forum Advanced Java
    Replies: 1
    Last Post: 01-30-2011, 02:30 AM
  4. PDF File creation Error
    By siva_vs_siva in forum New To Java
    Replies: 2
    Last Post: 12-24-2010, 12:42 AM
  5. Getting error with table packages..
    By doha786 in forum New To Java
    Replies: 2
    Last Post: 03-31-2010, 10:20 AM

Posting Permissions

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