Results 1 to 3 of 3

Thread: Bulk Update

  1. #1
    Join Date
    Aug 2012
    Posts
    6

    Question Unanswered: Bulk Update

    Hi everyone,

    What would be the easiest and optimize code for bulk update in mysql?

    Currently, im using the StringBuffer to append first the data from database.
    This is my sample code:

    PHP Code:
        while(rs.next()){
                
    transacId =rs.getString("transacId");
                
    sb.append("transacId='"+transacId+"' or ");
                
    sb1.append("('"+transacId+"','"+iNow+"'),");
            }
            
    bulkupdate=sb.toString();
            
    bulkinsrt=sb1.toString();
            
    String aa="update utang_entries_dummy set billingflag=-1 where "+bulkupdate;
            
    String bb="insert into utang_entries_cleanup(transacId,date) values "+bulkinsrt

    but i think, it has more reliable than this..

    Thanks.

  2. #2
    Join Date
    Aug 2012
    Posts
    7
    What are You looking for? Sql magic or another database Java access method ?

  3. #3
    Join Date
    Aug 2012
    Posts
    6
    Quote Originally Posted by Goyathlay View Post
    What are You looking for? Sql magic or another database Java access method ?

    Hi Goyathlay,

    I already solved this. I used the IN command. sql magic makes me laugh..

Posting Permissions

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