2nd try, parameter values

M

melinda.pluma

I'm having problems posting... sorry if this comes up twice.

I have parameter values set to make things easier for the users...

The prompt pulls Last Name or Emp #. If the Emp# is not available, is
there a way to search by last name, including suffixes, but only
entering the last name? or even just the first letter of the last
name?
 
J

John W. Vinson

I'm having problems posting... sorry if this comes up twice.

I have parameter values set to make things easier for the users...

The prompt pulls Last Name or Emp #. If the Emp# is not available, is
there a way to search by last name, including suffixes, but only
entering the last name? or even just the first letter of the last
name?

Sure.

LIKE [Enter part of last name:] & "*"

will find Jacobs, Jones, etc. if the user type J.

John W. Vinson [MVP]
 
J

Jamie Collins

I have parameter values set to make things easier for the users...
Good for you :) Even better if you support users who want to use both
flavours of ANSI Query Mode...
The prompt pulls Last Name or Emp #. If the Emp# is not available, is
there a way to search by last name, including suffixes, but only
entering the last name? or even just the first letter of the last
name?

e.g.

CREATE PROCEDURE GetEmployees (
[arg_Emp#] INTEGER = NULL,
arg_last_name VARCHAR(35) = NULL
)
AS
SELECT [Emp#], last_name, first_name, middle_name
FROM Employees
WHERE
(([arg_Emp#] IS NOT NULL AND [Emp#] = [arg_Emp#]) OR
([arg_Emp#] IS NULL AND (last_name LIKE arg_last_name & '*' OR
last_name LIKE arg_last_name & '%')));

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top