A quick question regarding numeric formatting and SQL Server 2000. I
have a view set up that has an integer field of length 4. When I fetch
the data, instead of seeing values such as '1024' as it is displayed in
SQL Enterprise Manager, the data shows up in my array ref as '1,024.00'.
I can remove the extra formatting with a little extra code but of course
would prefer not to do so. Searching the SQL Server docs didn't
enlighten me at all as to the cause of this. I am testing on an XP
laptop and PPM tells me both DBI and DBD-ODBC is up to date with current
ActiveState versions.
Thanks for any help.
-Jim
$sth = $dbh->prepare("SELECT ContactLocationID, ContactLocationName,
ContactID, UniqueID FROM qryTerritories");
die "ERROR: Cannot prepare statement: $DBI::errstr\n" unless (defined
$sth);
$sth->execute or die $sth->errstr;
my @territory_rows = $sth->fetchall_arrayref;
$sth->finish;
@territory_rows = @{ $territory_rows[0] } [0..$#{$territory_rows[0]}]; #
is this the best way?
for ($loop=0; $loop < $#territory_rows + 1; $loop++) {
$territory_rows[$loop][ssContactID] =~ s/,|\.00//g; # remove extra
formatting so '1,024.00' becomes '1024'
$territory_rows[$loop][ssContactID] = int(
$territory_rows[$loop][ssContactID] ); # '1,024.00' = 1 unless
substitution of previous line is done
}