UPDATE Problem

Discussion in 'MySQL' started by tanvirtonu, Apr 15, 2008.

  1. #1
    CAN anybody pls tell me where is the problem with the following UPDATE SQL-

    UPDATE Month_Rent SET rent_date='4/15/2008', gas ='sd', swearage ='sd', water ='sd', elec_100 ='sd', elec_400 ='sd', elec_service_a-d ='sd', elec_service_e-h ='sd', elec_demand ='sd', elec_vat ='sd' WHERE rent_id='4-2008'

    I have 11 fields(including PK) all of which is of VARCHAR type except the rent_date(date type)
     
    tanvirtonu, Apr 15, 2008 IP
  2. Mr_2

    Mr_2 Peon

    Messages:
    980
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what error you get when you execute this query?
     
    Mr_2, Apr 15, 2008 IP
  3. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Chances are your putting a string into a numeric field or vice versa.

    paste the error.
     
    LittleJonSupportSite, Apr 15, 2008 IP
  4. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Are you using MySQL? If so then the date format should be yyyy-mm-dd i.e.
    UPDATE Month_Rent SET rent_date='2008-4-15', gas ='sd', swearage ='sd', 
    water ='sd', elec_100 ='sd', elec_400 ='sd', elec_service_a-d ='sd', 
    elec_service_e-h ='sd', elec_demand ='sd', elec_vat ='sd' 
    WHERE rent_id='4-2008' 
    Code (markup):
     
    mwasif, Apr 15, 2008 IP