I have a DBI script to extract information via ODBC from a MSSQL server.
I can get everything I need BUT on one returned value $mso in the
following script I want to match one word. It is always MS0?-??? .How
can I go about doing this?

SAMPLE MS0?-??? ENTRY
========================================================================
=
<A
href="http://www.microsoft.com/technet/security/Bulletin/MS04-022.mspx";
targe

SCRIPT BELOW
========================================================================
=

#
# Report SQL from the Retina database
#

use DBI;
use strict;

# Connect to the database
my $dbh = DBI->connect("dbi:ODBC:Retina", 'USERNAME', 'PASSWORD',
{RaiseError => 1 });

# Set LongTruncOk to 1 so the longtruncated entries won't fail
$dbh->{'LongTruncOk'} = 1;

# The SQL statement
my $statement = "SELECT dbo.evt.evtSubj, dbo.evt.evtSubjDesc,
dbo.evt_nvp.nvpValue
                 FROM dbo.evt INNER JOIN dbo.evt_nvp ON dbo.evt.id =
dbo.evt_nvp.id
                 WHERE (((dbo.evt_nvp.nvpValue) Like '%MS04-02%'))
                 ORDER BY dbo.evt.evtSubj DESC;";
    
# Prepare and execute the SQL statement
my $sth = $dbh->prepare($statement);
$sth->execute();
    
print "\n";
print "IP Address      Name             \n";
print "--------------- -------------------------------------\n";
    
# Iterate through all the fields and dump the field information
#while (my (@row) = $sth->fetchrow_array){
#    print "@row\n";    
#    }

#print "------------------------------------------------------\n";
while (my(@row) = $sth->fetchrow_array)
{
    my $ip = $row[0];
    my $name = $row[1];
    my $mso = $row[2];  <-- This is where I want to only report the
MS0?-??? pattern
    
    print "$ip\n";
    print "$name\n";
    print "$mso\n";
}
    
# Print format the results
    

# Explicitly deallocate the statement resources
$sth->finish();

exit;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to