Perobl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I'm having some trouble getting UPDATE to work with my MS SQL Server.

my $sth = $dbh -> prepare("UPDATE vac_balance SET carry_over = ? WHERE + employee_id = ?"); $sth -> execute($carry_over, $employee_id);

SQL doesn't seem to like my prepare statement. What am I doing wrong?

Thank you.

Replies are listed 'Best First'.
Re: UPDATE not working with MS SQL Server
by keszler (Priest) on Nov 04, 2011 at 16:24 UTC

    What does

    my $sth = $dbh -> prepare("UPDATE vac_balance SET carry_over = ? WHERE + employee_id = ?") or die $dbh->errstr; $sth -> execute($carry_over, $employee_id) or die $dbh->errstr;
    say?

      I spotted my problem ... of course, after I posted here.

      The code shared in my post is clean. The problem is in my SQL schema. There was a field name mismatch.

      All is working fine now.

        It's good practice to use the die statement, especially with databases, as it probably would have informed you of a bad column name.