my $dbh = DBI->connect( "dbi:Sybase:server=$dbServer;hostname=$hostname;database=clearingdb", $dbUser, $dbPasswd->[1],{AutoCommit => 1}); my $insertStatement = $dbh->prepare("INSERT INTO BatchFile (FileName,FileStatusCode,FileDate,FileFormatCode,TotalRecords,LoadStartTime,ModifiedDate,ModifiedBy) VALUES ('Akash',4,GetDate(),0,3,GetDate(),GetDate(),'FIX2MQ')") or $DBI::err and die($DBI::errstr); my $id = $dbh->last_insert_id(undef,undef,undef,undef) or die "no insert id $DBI::errstr $!"; print "ID : ",$id; my $updateStatement = $dbh->prepare("UPDATE BatchFile SET FileStatusCode = ? ,ModifiedDate = GETDATE(),TotalRecords = ? WHERE BatchFileID = ?"); $updateStatement->execute(6,1,$id) or die($DBI::errstr); $insertStatement->finish(); $updateStatement->finish(); my $rc = $dbh->disconnect or die($DBI::errstr);