Click to See Complete Forum and Search --> : substring, patindex?
Lafor
Oct 16th, 2000, 12:30 PM
Hi!
I have name fields in a table
like
Bond James
Want to wipe out James
select name from table where ???????
Any help is appreciated...
JHausmann
Oct 16th, 2000, 02:09 PM
select name from table where name like "Bond *"
-or-
select name from table where name like "Bond %"
Lafor
Oct 16th, 2000, 03:27 PM
The problem was I had to do it on all the names on the table
But the solution I came up with
was
select name = substring(ltrim(name),1,PATINDEX("% %",ltrim(name)))
where patindex("% %",name) > 0
removes text following a space from the name
while ignoring leading spaces (in fact it removes them as well)
Thanks again
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.