Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    Texas, USA
    Posts
    1

    Question Unanswered: Restructuring a Query in Perl

    i have written some queries in SQL that work fine on my Access2002 Database, but when i transfer them to my Perl script I have to make some changes to them in order to get them to accept the user input values for the query.

    For Instance, on my Front end DB the Query for a person by Last Name, Last Initial, Partial Last naem, First Name, First initial, part of first name, or a combination of any of the first and last inputs is simply made by this part of the query:

    Where (([Persons.Lname] Like [Enter Last Name] & "*") AND ([Persons.Fname] Like [Enter First Name] & "*"))

    However, in Perl, i have to chage it to this:

    Where (([Persons.Lname] Like '$Lname') AND ([Persons.Fname] Like '$Fname'))

    it won't accept the part with the & "*", and I don't know how to make it do that so that it can use an initial to find any name starting with that initial...... Therefore if the user doesn't know both names, and spell them as they are spelled in the DB, no returns are found.

    Can anyone help me make the "wildcard" entries I want?

    Thanks,

    Mac

  2. #2
    Join Date
    Sep 2002
    Location
    Germany, near Aachen
    Posts
    120

    Re: Restructuring a Query in Perl

    Where (([Persons.Lname] Like [Enter Last Name] & "*") AND ([Persons.Fname] Like [Enter First Name] & "*"))

    However, in Perl, i have to chage it to this:

    Where (([Persons.Lname] Like '$Lname') AND ([Persons.Fname] Like '$Fname'))
    I think the & "*" part appends a '*' to the entered value so that it looks like 'Jo*' and the engine would find 'Joe', 'John', 'Jonathan' aso.

    You can just append a '*' to the variable in your Perl program:
    Where (([Persons.Lname] Like '$Lname*') AND ([Persons.Fname] Like '$Fname*'))

    Regards

    Bernd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •