I have recently started working for a company that in someone's infinite wisdom decided to name a column in MSSQL Server 2000 as the reserved keyword 'date'.
I am trying to pull some data out of a table that the only unique field is this date field. I have tried the below code, but it does not return any records. I have tried the same query with other fields and it all works good. The query with the date field is the only one that causes problems. Anyone have any ideas?
my $SQL = "Select DistinctSessions from $database_FMJtable WHERE ([Date]='05/24/04')";
print "$SQL\n";
my $FMJsth = $dbh->prepare($SQL) or warn "Cannot prepare SQL statement: $dbi::errstr\n";
$FMJsth->execute or warn "Cannot execute SQL statement: $dbi::errstr\n";
while (@FMJTempArray = $FMJsth->fetchrow_array()){
print "$FMJTempArray[0]\n";
}
The idea is that I am going to be looping through and putting dates in to pull out the one field. The results I am pushing to an array so that I may sum them all later to get a final number. The results from this query should return just one record.
Thanks in advance.
Tazzmann
I am trying to pull some data out of a table that the only unique field is this date field. I have tried the below code, but it does not return any records. I have tried the same query with other fields and it all works good. The query with the date field is the only one that causes problems. Anyone have any ideas?
my $SQL = "Select DistinctSessions from $database_FMJtable WHERE ([Date]='05/24/04')";
print "$SQL\n";
my $FMJsth = $dbh->prepare($SQL) or warn "Cannot prepare SQL statement: $dbi::errstr\n";
$FMJsth->execute or warn "Cannot execute SQL statement: $dbi::errstr\n";
while (@FMJTempArray = $FMJsth->fetchrow_array()){
print "$FMJTempArray[0]\n";
}
The idea is that I am going to be looping through and putting dates in to pull out the one field. The results I am pushing to an array so that I may sum them all later to get a final number. The results from this query should return just one record.
Thanks in advance.
Tazzmann