On Sat, 2004-12-04 at 23:42, Brian Roy wrote:
> 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)
That's a "parametrized" language command. Normally the client app will
send this first, and then send each of the parameters that correspond to
the @Px parameters, and then execute the command. I don't really know
ODBC - have you tried turning on DBI->trace() to get more details on the
client side?
Michael
--
Michael Peppler Data Migrations, Inc.
[EMAIL PROTECTED] http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html