Hello,

I was under the impression that placeholders would work in ODBC. I was
hoping this was the case as I don't want to rewrite my code that works
under mySQL. I'm trying to insert into MS SQL server with the same
statements. Please let me know if there is something I'm missing here.

sub sqinsert ()  {
        my ($names, $formdata) = @_;
        my $fields = join(', ', @$names);
        my $places = join(', ', ('?') x @$names);
        my $sql = "INSERT into $table ($fields) values ($places)";
        $sth = $dbh->prepare($sql);
        $sth->execute(@$formdata) || die $dbh->errstr;;
        $sth->finish();
        }

This is what I receive when I watch profiler on the SQL server. The
?'s get populated but they are with '@P's. I'm not sure how/why this
is happening.

INSERT into queue_stats (qdate, qtime, callid, queue, exten, qevent,
qholdtime, qcalltime, qorigposition) values (@P1, @P2, @P3, @P4, @P5,
@P6, @P7, @P8, @P9)

Anyone have any experience with this or know what I might be doing wrong?

Thanks,

Brian

Reply via email to