Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ltrim ? query

Status
Not open for further replies.

Palmyra

Programmer
Jan 5, 2007
150
US
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.

Thanks.

 
Code:
SELECT SUBSTRING(YourField, 3, 8000) AS YourField
....


Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
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.
--------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top