How to delete a record with the key which contains "%20"(space) in the front?
Posted in 2003
Topics: General Discussion
When adding record, there are a lot of cases that user accidently add space sign "%20" in the front or end of the key. Let's say: Key is defined as "name". When the user put " Kerry" or "Kerry " as key and create this record, it will cause Database error when the second guy adds "Kerry"(No spaces) What SQL syntax will make sure deleting " Kerry" and "Kerry " safely? Thx
How about trimming the leading/trailing spaces on the front-end before it gets into the database? Is that a possibility? As far as safely deleting, I can't imaging using an SQL that uses the name alone as a condition for deleting a record (delete from mytable where lastname = "SMITH"). That sounds dangerous! > When adding record, there are a lot of cases that user accidently add space > sign "%20" in the front or end of the key. > > Let's say: > > Key is defined as "name". > > When the user put " Kerry" or "Kerry " as key and create this record, it > will cause Database error when the second guy adds "Kerry"(No spaces) > > What SQL syntax will make sure deleting " Kerry" and "Kerry " safely? Thx