grashoper has asked for the wisdom of the Perl Monks concerning the following question:
use Win32::ODBC; use DBI; $DSN="Ptest"; $db = new Win32::ODBC("DSN=Ptest;UID=userid;PWD=password;"); if(!($db)){ print "Error connecting"; exit; } else { print "Hey you are connected \n"; } my $file="data.txt"; my %hash=(); open(file,$file) or die; { local $/ = undef; %hash = split /\,/,<file>; $sqlstatement="Insert '$value->{0}' into dbo.Results"; while ( my ($key, $value) = each(%hash) ){ print "$value => $key\n"; if($db->SQL($sqlstatement)){ print "abysmal failure try again"; } close file; ---Data---Sample of data-- 1/5/2009 3:55:30 PM,Login,18.490683,SearchLoad,15.012853,SearchCount,0 +:0.392878,SearchResults,16.048765,SearchSave,6.629372,SearchDelete,9. +614098,SearchDetails,4.587307,TaxLoad,5.215133,TaxResults,0:2.956125, +TaxDetails,5.226226,ClientAdd,4.834234,CMALoad,1.841135,CMASave,12.44 +1073,CMADelete,0.218266,ClientDelete,0.268565,Logout,0.822440,1/5/200 +9 5:04:39 PM,Login,12.841120,SearchLoad,5.733201,SearchCount,0:0.1874 +62,SearchResults,6.998567,SearchSave,1.812129,SearchDelete,0.906065,S +earchDetails,4.108532,TaxLoad,2.343270,TaxResults,0:2.765057,TaxDetai +ls,2.468244,ClientAdd,1.593423,CMALoad,1.655911,CMASave,8.092093,CMAD +elete,0.187461,ClientDelete,0.187461,Logout,0.781090
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: sql and hash confusion
by lostjimmy (Chaplain) on Mar 19, 2009 at 19:42 UTC | |
by grashoper (Monk) on Mar 20, 2009 at 12:21 UTC | |
Re: sql and hash confusion
by olus (Curate) on Mar 19, 2009 at 19:33 UTC | |
Re: sql and hash confusion
by bichonfrise74 (Vicar) on Mar 19, 2009 at 21:28 UTC | |
Re: sql and hash confusion
by Anonymous Monk on Mar 20, 2009 at 01:07 UTC |