sql import error

Discussion in 'Databases' started by msk19994, Jul 25, 2010.

  1. #1
    hey as i am importing my sql i receive this error

    #1067 - Invalid default value for 'time_stamp'

    in my db time_stamp coding is
    time_stamp datetime default 'now()',
    so tell me guys what to do
     
    msk19994, Jul 25, 2010 IP
  2. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Default values in MySQL must be constant - they cannot be functions or expressions that evaluate to anything. Consider using the timestamp type with the default set to 'CURRENT_TIMESTAMP'.
     
    Deacalion, Jul 25, 2010 IP
  3. msk19994

    msk19994 Well-Known Member

    Messages:
    1,030
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    160
    #3
    i changed it to time_stamp datetime default 'CURRENT_TIMESTAMP', but still same error i have attached the orignal database file if u u can see what is the problem in it and fix it then that would be great
     

    Attached Files:

    msk19994, Jul 25, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You still haven't changed the data type of the field 'time_stamp'.

    Change line 18:
    
    	time_stamp datetime default 'now()',
    
    Code (markup):
    To this:
    
    	time_stamp  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    
    Code (markup):
     
    Deacalion, Jul 26, 2010 IP
  5. msk19994

    msk19994 Well-Known Member

    Messages:
    1,030
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    160
    #5
    i only changed 'now()', to 'CURRENT_TIMESTAMP', before it was not working i didnt know that i had to replace the whole file and i did change it the file i attached was the orignal 1 in which i didnt change a thing

    and thanks mate now the sql has been imported thanx mate thanx gave u rep
     
    msk19994, Jul 26, 2010 IP
  6. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ahh ok. Glad it's working. :) and thanks!
     
    Deacalion, Jul 26, 2010 IP
  7. msk19994

    msk19994 Well-Known Member

    Messages:
    1,030
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    160
    #7
    ur welcome
     
    msk19994, Jul 26, 2010 IP