$dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=;UID=;PWD=") ; my $sth = $dbh->prepare("select id,name,job,location from .employee_relation"); $sth->execute; my $hash = $sth->fetchall_hashref('id'); print Dumper($hash);