roho has asked for the wisdom of the Perl Monks concerning the following question:
I expected to receive:
one
two
three
as the output, but received only the first output, "one".
Questions:
1. Is this possible using DBI?
2. If so, how can it be accomplished?
The following minimal set of code demonstrates the issue.
use warnings; use strict; use DBI; my $usr = '<domain userid>'; my $psw = '<domain password>'; my $dsn = 'dbi:ODBC:Driver={SQL Server};<servername>;Database=master;T +rusted_Connection=yes'; my $dbh = DBI->connect($dsn, $usr, $psw, { RaiseError => 1 }); my $cmd = q(select 'one';select 'two';select 'three';); my $sth = $dbh->prepare($cmd); $sth->execute(); while (my @data = $sth->fetchrow_array) { print "@data\n"; } $sth->finish;
"It's not how hard you work, it's how much you get done."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to retrieve multiple output sets using DBI
by hippo (Archbishop) on Feb 08, 2019 at 16:46 UTC | |
by roho (Bishop) on Feb 08, 2019 at 17:27 UTC | |
|
Re: How to retrieve multiple output sets using DBI
by poj (Abbot) on Feb 08, 2019 at 17:44 UTC | |
by roho (Bishop) on Feb 08, 2019 at 18:48 UTC | |
|
Re: How to retrieve multiple output sets using DBI
by NetWallah (Canon) on Feb 08, 2019 at 18:20 UTC | |
by roho (Bishop) on Feb 08, 2019 at 18:51 UTC |