The following code works well.
#! perl -w scipt use strict; use DBI; use DBD::ODBC; my ( $data_source, $database, $user_id, $password ) = qw( ip_adddreaa +First natt silver ); #not real my $conn_string = "driver={SQL Server}; Server=$data_source; Database= +$database; UID=$user_id; PWD=$password"; my $dbh = DBI->connect( "DBI:ODBC:$conn_string" ) or die $DBI::errstr; my $user_specified_table_name = "Doncaster_Deaths 1975_onwards_slim_D" +; create_table($user_specified_table_name); sub create_table ($) { my($table_name) = $_; if (my $table_name eq /Doncaster_Deaths_1975_onwards_slim_D/){ my $sql = qq{ CREATE TABLE Doncaster_Deaths_1975_onwards_slim_D (y +ear_of_death int NOT NULL, ageyear +s int NOT NULL, sex int + NULL, undcaus +e varchar(5) NULL, oacode +varchar(10) NULL, )}; $dbh->do($sql); $dbh->disconnect(); } }
C:\Documents and Settings\Matthew\2003\Perl\November\7_11_03>perl Crea +ting_tabl e_B.pl main::create_table() called too early to check prototype at Creating_t +able_B.pl line 14. Use of uninitialized value in pattern match (m//) at Creating_table_B. +pl line 22 . Use of uninitialized value in string eq at Creating_table_B.pl line 22 +.
Can anyone explain the messages?
In reply to Creating table DBI by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |