Hi guys just wandering if I could get a little help! , I have wrote a Perl script to sort out some data in my database, I am saving into an sql file but having a few problems executing the sql because of capital letters.
I have been given a list of 'From' and 'To' names, as there are multiple entries in my DB eg. Fred Bloggs, Bloggs Fred, F Bloggs are all the same person but I have organised the list like so.
Bloggs Fred, Fred Bloggs
F Bloggs, Fred Bloggs
Fred Bloggs, Fred Bloggs
So values on the left are 'From' and values on the right are 'To'.
heres my code: - #!perl.exe
-
# script to CLEAN the AX4GANGS table
-
# If values of FROM and TO are the same then ignore!
-
# If values of FROM and TO are different INSERT 'To Names' to AX4GANGS table.
-
# Delete values of FROM, from AX4GANGS table
-
#
-
# Jonny Carter
-
#
-
#
-
-
BEGIN
-
{
-
( $SCRIPTNAME=$0 )=~s/^.*\\//g;
-
$SCRIPTNAME=~s/^.*\\//g;
-
-
#get the pm libfiles
-
push( @INC, "../pm" );
-
}
-
-
use CGI;
-
use DBI;
-
use DBNAME;
-
use LOG;
-
use Time::Local;
-
-
$dbh=DBI->connect("dbi:mysql:host=$DB_host:dbname=$database",$DB_user,$DB_pass)
-
or die "could not conect to database $database";
-
-
%allaudited=( getsqllist( "select distinct AUDITED, '1' from AX4GANGS " ) );
-
$n=keys(%allaudited);
-
-
-
open FILE, "ax4audit.csv" or die $!;
-
-
while( $line=<FILE> )
-
{
-
chomp $line;
-
($count,$company,$from,$to) = split( ',', $line );
-
-
# AX4GANGS INSERTS and DELETES
-
-
-
( $from eq $to ) && next;
-
-
if ( ! $allaudited{$to} )
-
{
-
print "INSERT INTO AX4GANGS VALUES (NULL,'$company','$to',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jonnyc',NULL);\n";
-
$allaudited{$to}="1";
-
-
}
-
print "DELETE from AX4GANGS where AUDITED='$from';\n";
-
-
-
# AUDITS Table UPDATES
-
-
print "UPDATE AUDITS set AUDITED ='$to' where AUDITED='$from';\n";
-
}
-
-
close ( FILE );
-
exit;
-
Heres an example of what is happening:
I have a value of JONny Carter and a value of Jonny Carter.
for some reason when I then run the sql file I get both inserted into the table.
I hope I have explained this well enough ... Any help is really appreciated.
1 2332
Ah I sorted it now !! but thanks any way!
It was my error, I put JONny into my .csv file in the 'To' column ...All is working fine now!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jeff |
last post by:
Hi, I am trying to insert a space before all capital letters in a string
except the first occurrence. For example:
FirstSecondThird
would become
First Second Third
Is there a regular expression or short function that can do this?
|
by: Carlos Marangon |
last post by:
Hello!
People go to sign my guestbook and wrote all text in capital letters.
Did you know any script that shows an window alert when one types the
second capital letter?
Best regards,
|
by: thomaz |
last post by:
How I can place in capital letters the text of a COMBOBOX?
For TEXTBOX I use:
textBox1.CharacterCasing = CharacterCasing.Upper;...
How to make the same for a COMBOBOX?
There isnt a CharacterCasing metod for a COMBOBOX...
|
by: Peter Afonin |
last post by:
Hello,
I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post
string I'm passing the data like name, address, phone number etc.
The only two fields that are causing problems are the phone and fax fields.
My only guess here is that's because they start with the "+" sign. So the
string looks like this:
|
by: Bertha94 |
last post by:
I am trying to set certain cells to capitalize any input whethere they have the caps lock on or not. I have toyed with "Private Sub Workbook_SheetChange" to turn all changes into an object with capital letters, but I am afraid if anyone ever removed the protection, that could be dangerous. I have also set the font on some of my worksheets to Perpetua Titling MT, which works well except that the font is a little funky. For some reason, on my...
| |
by: wbosw |
last post by:
I'm trying to create a regex to find more than one capital letter position within a word. The below regex, finds the first capital letter in the word and returns the index for that character. I would like to find both capital letter positions in the word heLLo and return both positions. Does anyone have any suggestions.
Thanks in advance,
Wbos
Public Function FindPosition(ByVal word As String)
' Create a new Regex object....
|
by: inferi9 |
last post by:
hi,
I am writng a program that takes a string and it must output if it is a palindrome,
A palindrome is a string that is spelled and read the same way forward and backward, it workes fine with one word but if there is spaces or capital lettersor commas it won't work I used getline but without any effect.here is the code.
#include <iostream>
#include <string>
using namespace std;
int main ()
{
|
by: Presto731 |
last post by:
HOW do i make the letters in various fields on a form always be capital no matter if they used capital letters or not when typing?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |