December 12, 2007 at 4:09 pm
Hey Everyone. I have...lots of problems... But I need some help on the one. I have a several columns, and need to parse the digits out of the column. I have come up with two statements, one grabs each side, but I can't seem to put them together. Any help Would be greatly appriciated.
Here are couple of Fields:
What I NEED is:
519
547
559
1049
What I have accomplished separately is:
SELECT SUBSTRING(PK, CHARINDEX('>',REVERSE(PK))-1 , LEN(PK)) FROM audit
<MSLID=519
<MSLID=547
<MSLID=559
<MSLID=1049
SELECT SUBSTRING(PK, Charindex('=',PK)+1 , len(PK)) FROM audit
519>
547>
559>
1049>
But I can't get both sides in the same query. Suggestions?
December 12, 2007 at 5:00 pm
Would this work?
SELECT SUBSTRING(PK, Charindex('=',PK)+1 , (len(PK)-1)) FROM audit
or you could wrap a replace..
SELECT replace(SUBSTRING(PK, Charindex('=',PK)+1 , len(PK)),'>','') FROM audit
December 13, 2007 at 10:53 pm
SELECT
LEFT(
RIGHT(PK,Len(PK) - charindex('=',PK)),
LEN(RIGHT(PK,Len(PK) - charindex('=',PK)))
-1)
December 14, 2007 at 1:53 am
SELECT SUBSTRING(pk, Charindex('=',pk)+1 , len(pk)-Charindex('=',pk)-1) from audit
Regards,
Ahmed
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy