in reply to Win2K DBI SQL example sought
use strict; # <- NOTE! my $dbh = DBI->connect(qw(DBI:vendor:database:host user pass), {RaiseError => 1}, ); my $strID = "foo"; my $sth = $dbh->prepare("UPDATE Images SET strID=? WHERE strID=?"); $sth->execute($strID, $strID); # ...
The row exists in this instance as you are attempting an update rather than an insert to the field strID, but you would be only overwriting the existing field value with the same data (in the example above "foo").
i.e. UPDATE Images SET strID=foo WHERE strID=foo
Thats what doesn't make sense to me, understand where I'm getting at?
So... I think it would be more like:
my $NewStrID = "foo"; my $OldStrID = "bar"; my $sth = $dbh->prepare("UPDATE Images SET strID=? WHERE strID=?"); $sth->execute($NewStrID, $OldStrID); # ...
i.e. UPDATE Images SET strID=foo WHERE strID=bar
Hope some of that made sense.
Update: {sigh}, LanceDeeply beat me to it..., must... type... faster... ;)
|
|---|