August 19, 2009 at 1:30 pm
I'm creating a view that has a field called PO_number. The PO numbers are varying lengths. They have trailing three spaces followed by a number of varying length. For example '8769098 987'. I want to only see the first set of numbers '8769098'. What function would work best to accomplish this?
Thanks
August 19, 2009 at 1:50 pm
A combination of Left and Charindex.
declare @String varchar(20);
select @String = '123 456';
select left(@String, charindex(' ', @String);
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 19, 2009 at 4:08 pm
That works. Thanks
August 20, 2009 at 6:49 am
You're welcome.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply