use DBI; my $dsn = 'driver={SQL Server}; Server=SERVERNAMEHERE; database=DBNAMEHERE; uid=UIDHERE; pwd=PWHERE'; my $dbh = DBI->connect("dbi:OOOO:$dsn",{AutoCommit => 1}) or die "$DBI::errstr\n"; my $sql = "select field1, field2 from location where restriction = 'RESTRICTION NAME'"; my $sth = $dbh->prepare( $sql ); $sth->execute(); $sth->finish(); $dbh->disconnect(); #### use DBI; my $dsn = 'driver={SQL Server}; Server=SERVERNAMEHERE; database=DBNAMEHERE; uid=UIDHERE; pwd=PWHERE'; # my %info = ( # field1 => "field1", # field2 => "field2" # ); my $dbh = DBI->connect("dbi:OOOO:$dsn",{AutoCommit => 1}) or die "$DBI::errstr\n"; #my $ref = $dbh->selectall_arrayref("select field1, field2 from location where restriction = 'RESTRICTION NAME'"); my $sql = "select field1, field2 from location where restriction = 'RESTRICTION NAME'"; my $sth = $dbh->prepare( $sql ); $sth->execute(); my @record = $sth->fetchrow_array; #my $href = $dbh->selectall_hashref("select field1, field2 from location where restriction = 'RESTRICTION NAME'"); #print "$_\n" for (keys %$href); # foreach (@record){ # print $_; # } print join(", ", @record); $sth->finish(); $dbh->disconnect();