http://www.perlmonks.org?node_id=310293

Win has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Can anyone please explain why the following bit of code:

my $sthC = $dbh->prepare("INSERT into Standard_population (Standar +disation_type, Male_00_04, Female_00_04, Male_05_09, Female_05_09, Ma +le_10_14, Female_10_14, Male_15_19, Female_15_19, Male_20_24, Female_ +20_24, Male_25_29, Female_25_29, Male_30_34, Female_30_34, Male_35_39 +, Female_35_39, Male_40_44, Female_40_44, Male_45_49, Female_45_49, M +ale_50_54, Female_50_54, Male_55_59, Female_55_59, Male_60_64, Female +_60_64, Male_65_69, Female_65_69, Male_70_74, Female_70_74, Male_75_7 +9, Female_75_79, Male_80_84, Female_80_84, Male_85_plus, Female_85_pl +us) VALUES ('EuropeanStandard','8000','8000','7000','7000','7000','70 +00','7000','7000','7000','7000','7000','7000','7000','7000','7000','7 +000','7000','7000','7000','7000','7000','7000','6000','6000','5000',' +5000','4000','4000','3000','3000','2000','2000','1000','1000','1000', +'1000');") or die "Couldn't prepare query: ".$dbh->errstr; $sthC->execute() or die "Couldn't execute query: ".$sthC->errstr;

Gives the following error messages:

DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL +Server]Str ing or binary data would be truncated. (SQL-22001) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been +terminated . (SQL-01000)(DBD: st_execute/SQLExecute err=-1) at Creating_table_H.p +l line 225 . Couldn't execute query: [Microsoft][ODBC SQL Server Driver][SQL Server +]String or binary data would be truncated. (SQL-22001) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been +terminated . (SQL-01000)(DBD: st_execute/SQLExecute err=-1) at Creating_table_H.p +l line 225