S
scooterm
### PROBLEM
I am looking for a more 'clever' way to put together a SQL
WHERE clause in msft access, so that I do not have to re-write
a particular SQL query whenever the fields in a table are
changed.
### DETAILS
I have a very simple query that looks like this:
SELECT *
FROM person
WHERE
fname = 'simpson'
OR lname = 'simpson'
OR mname = 'simpson'
OR sname = 'simpson'
What I would *really* like to do is (even though this is not
valid SQL):
SELECT *
FROM person
WHERE
any_text_field = 'simpson'
### QUESTION
Is there a clever way (using pure SQL in msft access) to obtain
the simplicity of the psuedo-SQL statement shown above?
### RATIONALE
The reason why I want to do this is: 1) I want to be able to change
the table without having to re-write the SQL query; 2) I don't really
care which field contained the value 'simpson'; 3) I don't want to
worry about error messages of 'mismatched type' from trying to evaluate
for 'simpson' on a field that is something other than a 'Text' field.
**Please** feel free to refrain from a critique of the underlying
rationale. I know the critique already, but this is a unique scenario,
just looking for an answer and a clever example that I may not have
already thought of.
I am looking for a more 'clever' way to put together a SQL
WHERE clause in msft access, so that I do not have to re-write
a particular SQL query whenever the fields in a table are
changed.
### DETAILS
I have a very simple query that looks like this:
SELECT *
FROM person
WHERE
fname = 'simpson'
OR lname = 'simpson'
OR mname = 'simpson'
OR sname = 'simpson'
What I would *really* like to do is (even though this is not
valid SQL):
SELECT *
FROM person
WHERE
any_text_field = 'simpson'
### QUESTION
Is there a clever way (using pure SQL in msft access) to obtain
the simplicity of the psuedo-SQL statement shown above?
### RATIONALE
The reason why I want to do this is: 1) I want to be able to change
the table without having to re-write the SQL query; 2) I don't really
care which field contained the value 'simpson'; 3) I don't want to
worry about error messages of 'mismatched type' from trying to evaluate
for 'simpson' on a field that is something other than a 'Text' field.
**Please** feel free to refrain from a critique of the underlying
rationale. I know the critique already, but this is a unique scenario,
just looking for an answer and a clever example that I may not have
already thought of.