UPDATE category SET chrCat_Full_Name=UPPER(LEFT(chrCat_Full_Name,1)) +LOWER(RIGHT(chrCat_Full_Name,DATALENGTH(chrCat_Full_Name)+1)) #### use DBI; require DBD::ODBC; ## will be done auto, but doesn't hurt to check. my $db = DBI->connect($dsn,'','',{RaiseError=>1}); my $db2 = DBI->connect($dsn2,'','',{RaiseError=>1}); my $sql ="SELECT * FROM category"; my $sth = $db->prepare($sql); $sth->execute(); ## ? is a placeholder that will be auto-quoted later! my $sql2 = 'update category set chrCat_Full_Name=? where chrCategory_Code=?'; ## now we get the DBI ready to execute that statement many times with different placeholders my $sth2 = $db2->prepare($sql2); while (my $data = $sth->fetchrow_hashref()) { ## the parameters passed will be quoted and substituted ## for the placeholders in order $sth2->execute( ucfirst( lc($data->{'chrCat_Full_Name'}) ), $data->{'chrCategory_Code'} ); ## this won't show your parameters, to do that you can trace ## or just explicitly print them. print "$sql2 $data->{'chrCat_Full_Name'}\n"; } $db->disconnect; $db2->disconnect;