May Repost: Take a Walk on the Wildcard Side
This is another oldie but goodie, written 5 years ago. Enjoy!
It's a very embarrassing moment in the life of a Siebel guy or gal when he or she finds records in the database that shouldn't be there at all.
I am talking about records like these:
It happened to all of us, doesn't it? Instead of querying, you create a new record with the query criteria as data.
The question is now, how can you find (and possibly eliminate) these "quericates"?
Simply querying for [Name] LIKE "*" OR [Name] LIKE "?" obviously won't work.
Here is the solution: Escaping wildcards using the backslash \ character.
The following is a query to retrieve all accounts who have an asterisk in their name:
That is one asterisk as a wildcard for any character, then the asterisk itself (escaped with \) and another wildcard for any character.
Works with other wildcards (?) too.
BTW: If you have keywords like AND or OR, or parantheses in your data, you can query for them using a single or double quote at the beginning or use the LIKE operator.
Example 1: LIKE "*AND*" will retrieve all accounts that have the word AND in their name.
Example 2: "Woolworth*(* will retrieve all accounts that start with Woolworth and have an open bracket in their name (note the double quote at the beginning of the query string.
have a nice day
@lex
***
It's a very embarrassing moment in the life of a Siebel guy or gal when he or she finds records in the database that shouldn't be there at all.
I am talking about records like these:
It happened to all of us, doesn't it? Instead of querying, you create a new record with the query criteria as data.
The question is now, how can you find (and possibly eliminate) these "quericates"?
Simply querying for [Name] LIKE "*" OR [Name] LIKE "?" obviously won't work.
Here is the solution: Escaping wildcards using the backslash \ character.
The following is a query to retrieve all accounts who have an asterisk in their name:
[Name] LIKE "*\**"
That is one asterisk as a wildcard for any character, then the asterisk itself (escaped with \) and another wildcard for any character.
Works with other wildcards (?) too.
BTW: If you have keywords like AND or OR, or parantheses in your data, you can query for them using a single or double quote at the beginning or use the LIKE operator.
Example 1: LIKE "*AND*" will retrieve all accounts that have the word AND in their name.
Example 2: "Woolworth*(* will retrieve all accounts that start with Woolworth and have an open bracket in their name (note the double quote at the beginning of the query string.
have a nice day
@lex
תגובות
הוסף רשומת תגובה