sqlcurious
asked on
replacing some characters with space
Hi I have a condition where I have to replace the MiddleName with space that has the following:
'and' 'jr' 'sr' '&*' 'of' anything containing numerics 'R1315', how do I change the below?
SELECT
W.ID,
(CASE when ISNUMERIC(REPLACE(M.Middle Name, ',' , ' '))=1 THEN NULL ELSE MiddleName END)AS [Middle Name],
'and' 'jr' 'sr' '&*' 'of' anything containing numerics 'R1315', how do I change the below?
SELECT
W.ID,
(CASE when ISNUMERIC(REPLACE(M.Middle
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please close your eyes for a moment.
At that point you will see exactly how much we know about your data :)
Please supply some sample data, and from that data, the result you want.
At that point you will see exactly how much we know about your data :)
Please supply some sample data, and from that data, the result you want.
ASKER
Id First Name Middle Name Last Name
995959 Estate of Steven
850018 Dominic F Meiklejohn
850019 Yolanda Cortese
850020 Ernest E Craumer
850022 Heidi W Hamilton
Sorry about that here is the sample data, let's just say I am unable to replace 'of' from the middle name(that's one of the conditions- replace 'of' with a space), let me know if you need more information.Thanks!
995959 Estate of Steven
850018 Dominic F Meiklejohn
850019 Yolanda Cortese
850020 Ernest E Craumer
850022 Heidi W Hamilton
Sorry about that here is the sample data, let's just say I am unable to replace 'of' from the middle name(that's one of the conditions- replace 'of' with a space), let me know if you need more information.Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If it contains "of" anywhere, are you aiming to null the column itself?
Are you updating the source table or just trying to return the results?
And what if the middle name is "M of D" for example... are we talking about a contains anywhere?
Are you updating the source table or just trying to return the results?
And what if the middle name is "M of D" for example... are we talking about a contains anywhere?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your inputs
ASKER
for the rest this is what I Am doing:
(CASE when ISNUMERIC(REPLACE(REPLACE(
but for some reason I still see 'of' in the results, any idea why it's not going away?