print "=== processing $server server ===\n"; my $DSN = "driver={SQL Server};Server=$server;database=master;uid=;pwd=;"; my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n"; $tsql = <<'END_QUERY'; use Northwind declare @d datetime declare @c int select @d = getdate() print @d print @d - 365*8 select @c = count(*) from Orders where ShippedDate > @d - 365*6 print @c END_QUERY # create a modified sp_helprotect that will output results in table version $sth = $dbh->prepare ($tsql); $sth->execute(); $out = ""; while (@row = $sth->fetchrow_array()) { # this is line 44 print $server,':',join(':',@row),"\n"; } $sth->finish(); $dbh->disconnect();