Please could someone explain why the following code.
#! perl -w scipt use strict; use warnings; use DBI; use DBD::ODBC; my ($data_source, $database, $user_id, $password) = qw( ************ * +********** ******** *********); my $conn_string = "driver={SQL Server}; Server=$data_source; Database= +$database; Trusted_Connection=yes"; my $dbh = DBI->connect( "DBI:ODBC:$conn_string" ) or die $DBI::errstr; my $Stored_procedure; my $Standardisation; my $Disease_cat; my $Sex; my $Sex_code; my $Constraint_ref; my $ICD_start_9; my $ICD_end_9; my $ICD_start_10; my $ICD_end_10; my $ICD_start_9_B; my $ICD_end_9_B; my $ICD_start_10_B; my $ICD_end_10_B; my $ICD_start_9_C; my $ICD_end_9_C; my $ICD_start_10_C; my $ICD_end_10_C; my $yearfrom; my $yearto; my $min_age; my $max_age; my $region; my $Instance_name; my $Geo_scope; my $number_of_years; my $unique_identifier; my $Query; $Stored_procedure = "make_geo_mortality_count_C_test"; $Standardisation = "\"EuropeanStandard\""; $Disease_cat = "\"All_Cancer\""; $Sex = 1; $Sex_code = "\"MF\""; $Constraint_ref = 1; $ICD_start_9 = "\"A140\""; $ICD_end_9 = "\"A208\""; $ICD_start_10 = "\"C45\""; $ICD_end_10 = "\"C97\""; $ICD_start_9_B = "\"A140\""; $ICD_end_9_B = "\"A208\""; $ICD_start_10_B = "\"C45\""; $ICD_end_10_B = "\"C97\""; $ICD_start_9_C = "\"A140\""; $ICD_end_9_C = "\"A208\""; $ICD_start_10_C = "\"C45\""; $ICD_end_10_C = "\"C97\""; $yearfrom = 2003; $yearto = 2004; $min_age = 0; $max_age = 75; $region = "\"Community\""; $Instance_name = "\"Random_place\""; $Geo_scope = "\"Random_town\""; $number_of_years = ($yearto - $yearfrom)+1; $unique_identifier = "\"tttttttttttttttttttttttttttttttttttt\""; $Query = "EXEC ".$Stored_procedure." ".$Standardisation.", ".$Disease_ +cat.", ".$Sex.", ".$Sex_code.", ".$Constraint_ref.", ".$ICD_start_9." +, ".$ICD_end_9.", ".$ICD_start_10.", ".$ICD_end_10.", ".$ICD_start_9_ +B.", ".$ICD_end_9_B.", ".$ICD_start_10_B.", ".$ICD_end_10_B.", ".$ICD +_start_9_C.", ".$ICD_end_9_C.", ".$ICD_start_10_C.", ".$ICD_end_10_C. +", ".$yearfrom.", ".$yearto.", ".$min_age.", ".$max_age.", ".$region. +", ".$Instance_name.", ".$Geo_scope.", ".$number_of_years.", ".$uniqu +e_identifier."\;"; print "$Query"; my $sthB_A = $dbh->prepare("$Query") or die "Couldn't prepare query: +".$dbh->errstr; $sthB_A->execute() or die "Couldn't execute query: ".$sthB_A->errstr;
gives me the following error message.
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL +Server]Err or converting data type nvarchar to int. (SQL-42000)(DBD: st_execute/S +QLExecute err=-1) at 20_October_2004_D.pl line 185. Couldn't execute query: [Microsoft][ODBC SQL Server Driver][SQL Server +]Error con verting data type nvarchar to int. (SQL-42000)(DBD: st_execute/SQLExec +ute err=-1 ) at 20_October_2004_D.pl line 185. EXEC make_geo_mortality_count_C_test "EuropeanStandard", "All_Cancer", + 1, "MF", 1, "A140", "A208", "C45", "C97", "A140", "A208", "C45", "C97", "A140", + "A208", " C45", "C97", 2003, 2004, 0, 75, "Community", "Random_place", "Random_t +own", 2, "tttttt tttttttttttttttttttttttttttttt";

In reply to Error message puzzle by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.