November 10, 2015 at 4:06 pm
Comments posted to this topic are about the item Extarcting string after and before a Character/Pattern
November 30, 2015 at 7:52 am
More of an article than a script, but good basic knowledge. Thanks.
January 6, 2017 at 5:15 am
This was good the last time I looked at it. Still is.
January 6, 2017 at 10:15 am
----select characters before / including /
select SUBSTRING ('abcde/wxyz',0,CHARINDEX('/','abcde/wxyz')+1)
I'm confused with the code above. Isn't the position of the first character of a string always = 1 ?
I ran these queries:
SELECT SUBSTRING ( 'abcde/wxyz', 0, 1 ) => returns nothing
SELECT SUBSTRING ( 'abcde/wxyz', 1, 1 ) => returns 'a'
Based on this, shouldn't the query be ?
----select characters before / including /
select SUBSTRING ('abcde/wxyz', 1, CHARINDEX('/','abcde/wxyz'))
Thank you
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply