Subject | Re: [firebird-support] how to suppress dashes in query results |
---|---|
Author | Svein Erling Tysvær |
Post date | 2016-02-12T07:52:03Z |
Using REPLACE in the WHERE clause means no index. If this is a huge table and you have no other selective WHERE criteria, I would recommend that you rather add another (indexed) field, have a trigger that is ACTIVE BEFORE INSERT OR UPDATE that sets this field using REPLACE, and then simply use this new proxy column in your WHERE clause. If it is a tiny table or if you always have other selective and indexed criteria, then doing things only in the WHERE clause is fine.
Set
2016-02-12 2:57 GMT+01:00 homer@... [firebird-support] <firebird-support@yahoogroups.com>:
Users can enter values with dashes (-) in random locations. I don't know where they might put them. I need to select a record using a where clause that doesn't have those dashes. For example, the user might record an insurance policy number as 12-345678-01 or 123-456-789-01. All I will know are the number, and not where they put the dashes. Is there a way to suppress the dashes in the Select Clause, or the Where Clause? This is being done in a Delphi 2007 program using IBDAC.
It would be nice if I could do something like ... SELECT * WHERE HIDE('-',UsersField) = 'MyValue'
Or the equivalent in the Select statement.