0
How can I cut part of a string, for example : "2017/12/teste.jpg", I only need to pick up "test.jpg".
0
How can I cut part of a string, for example : "2017/12/teste.jpg", I only need to pick up "test.jpg".
1
This command will take everything that is afterward of the latter /
select right(minhaString, charIndex('/', reverse(minhaString) + '_') - 1)
This will take everything that is before of the latter /
select left(minhaString, len(minhaString) - charindex('/', reverse(minhaString) + '/'))
And to always pick up from the 9th character:
substring(@string, 9, len(@string))
Thanks, I didn’t know about CHARINDEX. I did it like this: "SUBSTRING(@string, 9, CHARINDEX(RIGHT(@string,1), @string))"
Good. You can also use this way: substring(@string, 9, len(@string))
, becomes a little simpler to read. :)
To conclude this post, post the answer and signal as correct or signal this response if it has served.
Browser other questions tagged sql
You are not signed in. Login or sign up in order to post.
You’ll probably need to use Substring and Charindex. The format is always that of YYYY/MM/name.jgp?
– Ronaldo Araújo Alves
Yes, always this, can give me an example?
– Victor Henrique