#!perl -w use strict; use DBI; my $D=DBI->connect("DBI:SQLite2:dbname=Store.db","",""); $D->do("CREATE TABLE ISP(Store INTEGER,Date CHAR[9])"); $D->do("CREATE TABLE UnityPrimary(Store INTEGER,Date CHAR[9])"); $D->do("CREATE TABLE UnitySecondary(Store INTEGER,Date CHAR[9])"); open(CSV,"reboots.csv")||die"Can't open: $!\n"; while(){ chomp; my($store,$isp,$pri,$sec)=split /,/; my $sta=$dbh->prepare("INSERT INTO ISP(Store,Date) VALUES($store,$isp)"); my $stb=$dbh->prepare("INSERT INTO UnityPrimary(Store,Date) VALUES($store,$pri)"); my $stc=$dbh->prepare("INSERT INTO UnitySecondary(Store,Date) VALUES($store,$sec)"); $sta->execute; $stb->execute; $stc->execute; } close CSV; my $sth=$dbh->prepare("SELECT * FROM UnityPrimary WHERE Store=1"); $s->execute; while(my@row=$s->fetchrow_array){ print "@row\n"; } $D->disconnect; #### 1,18-Oct-04,29-Oct-04,29-Oct-04 2,18-Oct-04,26-Oct-04,26-Oct-04 3,21-Oct-04,26-Oct-04,11-Aug-04 4,20-Oct-04,11-Jun-04,27-Oct-04 5,18-Oct-04,3-Sep-04,24-May-04 6,17-Oct-04,15-Oct-04,15-Oct-04 #### DBD::SQLite2: :st execute failed: no such column: Oct(1) at dbdimp.c line 412 at C:\WINNT\Profiles\toms\Desktop\createdb.pl line 26, line 1. DBD::SQLite2: :st execute failed: no such column: Oct(1) at dbdimp.c line 412 at C:\WINNT\Profiles\toms\Desktop\createdb.pl line 27, line 1. DBD::SQLite2: :st execute failed: no such column: Oct(1) at dbdimp.c line 412 at C:\WINNT\Profiles\toms\Desktop\createdb.pl line 28, line 1.