July 30, 2004 at 1:37 pm
Simple question for the right Ghuru.
What is the correct to do this:
SELECT [?] FROM Course
Sample Entries in Course Table
SimID:
C9999_000
C6756_000
C5436_000
C65788_000
C546777_000
Desired result set:
C9999
C6756
C5436
C65788
C546777
July 30, 2004 at 2:56 pm
either
select replace( SimID, '_000','') FROM Course
or
select left(SimID,len(SimID)-4) FROM Course
All depends how you want to do it , and what the data looks like.
----------------
Jim P.
A little bit of this and a little byte of that can cause bloatware.
July 30, 2004 at 4:19 pm
Thanks Jim,
July 30, 2004 at 7:07 pm
You can also use CHARINDEX to find the place where the underscore is and take a substring up to that point.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply