my $sth = $dbh->prepare("exec sp_helptext ?"); $sth->execute($_[0]) || die ("cannot run sp"); while(my @data = $sth->fetchrow_array()) { print join(q{,}, @data) . "\n".$data[1]; } $sth->finish; $sth=undef;