I need a query that will trim the left two characters from a field where those two characters are always 'wb'. The length of the data in the field can be variable.
Without actually testing it, something along the lines of the following should get you there:
Code:
SELECT
[Trimmed] = CASE WHEN LEFT(field1, 2) = 'wb' THEN RIGHT(field1, LEN(field1) - 2) ELSE field1 END
FROM Table1;
--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.