Link to home
Start Free TrialLog in
Avatar of Grayson Hampton
Grayson Hampton

asked on

Remove character from character string

How do I create a Case Statetment that deletes all ConsultantIDs that have an R and/or S?


ConsultantID
1001004
1001004R
1001004S
200311
200311R
200311S
Avatar of Arana (G.P.)
Arana (G.P.)

No need for a case statement, you could do that with a delete statement

delete from table where (charindex('S',ConsultantID)+charindex('R',ConsultantID))>0;
Avatar of Grayson Hampton

ASKER

arana...

I would like to use this process in a Select statement that removes the characters.
so you dont want to delete ConsultantID but rather remove the S and R characters from the field?
@arana...

Yes, that is correct. I just want to delete S and R characters from the string.
ASKER CERTIFIED SOLUTION
Avatar of Arana (G.P.)
Arana (G.P.)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@arana...

No I do not have a specific reason to use Case.
then one of the above examples will work for you
Thank you arana for being extremely helpful and responsive.