I've upgraded the articles section on my site from ASP classic to C#, and I'm having trouble isolating a string on the URL to select the page number. At present, my site URL would look like this:
Sitename/ArticleName/1
This would give me page 1. If I change the URL to:
Sitename/ArticleName/2
I want to be able to view the second page - can anyone show me how to isolate the number after the split and then declare it as a variable in order to use it in my select statement?
At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.
set @test = 'Sitename/ArticleName/20'
select substring(
@test,
len(@test) - charindex('/', reverse(@test)) + 2,
charindex('/', reverse(@test)))