I saw the question on [EMAIL PROTECTED] and accidentally replied to just the questioner and not the mailing list too - sorry.

The questioner also asked the question on the comp.databases.informix news group, so I'm copying my answer there too; there shouldn't be a need for others to chip in unless my outline answer is grossly wrong.

--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
--- Begin Message --- Brian McLaughlin wrote:
I have two Informix servers -- a production box and a test box.  Passwords
to our vendor's software are stored encrypted in a char(20) column.  I want
to copy passwords from production to test.  I've written a perl script to
fetch the password from production and I want to put that password into the
same table/column on the test box.  The problem is that the encrypted
passwords have non-ascii characters.

update user_mst set access_code = "blahblah" where id="235112"

This update command gives me this:
DBD::Informix::db do failed: SQL: -202: An illegal character has been found
in the statement. at ./3000create.pl line 27.

How can I copy the contents of one char column to another if the data
contains "illegal characters" ??

Read the value into a Perl variable, and then use the Perl variable as an argument to the UPDATE...


$st_prod = $db_prod->prepare("SELECT access_code, id FROM user_mst");
$st_prod->execute;
$st_test = $db_test->prepare("UPDATE User_MST SET Access_Code = ? WHERE Id = ?");
($prod_password, $prod_id) = $st_prod->fetchrow_array();
$st_test->execute($prod_password, $prod_id);


I'm assuming you have RaiseError = 1 or you should add error handling code; you should also loop on the fetch and execute.

The technique is hardly Informix-specific either.


--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/



--- End Message ---


Reply via email to