I'd like a simple perl script / sub to read a sql server table into a hash, does anyone have a good script or snippet (with 'use's) that can do this given a connection string and table name?
Here's a template:
sub sqltable {
my ($connStr,$table) = @_;
my ($user, $password, $host) = ($connectstr =~ m|^(.*)/(.*)@(.*)$|); # or whatever
my $dbh = DBI->connect("dbi:???:$host",$user,$password, { RaiseError => 1 }); # replace ??? with good SQL Server equivalent
$dbh-> ???; # anything good for this part? LongTruncOk? LongReadLen?
return $dbh->selectall_arrayref("select * from $table");
}