Sachin_dada has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, Using localtime fn to get the Hour:min(time) & i want to update this in database, using the update scripts.. But it shows some error with the scripts...Can some pls help me.. Pls find the code below
#!/usr/bin/perl -w use Time::Local; use DBI; my ($sec,$min,$hour,$day,$month,$yr19,@rest) = localtime(time); + my $tim = "$hour:$min"; my $dbh = DBI->connect($data_source) or die "Can't connect to $data_source: $DBI::errstr"; my $sql = "DECLARE @log varchar(5) SET @log=$tim Update dbo.tltime set + logtime = @log"; my $sth = $dbh->prepare($sql) or die "Can't prepare statement: $DBI::errstr"; $sth->execute(); while ( my @row = $sth->fetchrow_array ) { foreach $row(@row) { print "$row"; } } I find error in the above query step....
I receive following errors : i) Incorrect syntax near '('. That is in Querying step.. ii)Incorrect syntax near '='.. this is also in Query step.. ii) Could not be prepared... Is this query syntactically, right? Can we execute such scripts in perl... some one plss help me...
|
|---|