billy_111 — 2010-12-29T11:03:06-05:00 — #1
I want to return a row from a table through sql. Now the row returns this:
I want to return it like this:
I am using SQL Server so i tried something like this:
SUBSTRING(SI.Location, CHARINDEX('/', 2), 1) AS Testing
But this returns as blank so it doesn't work. Any ideas how i can get this working?
SI is the name of the table and Location is the row.
r937 — 2010-12-29T11:24:05-05:00 — #2
, LEN(SI.Location) -
) AS Testing
billy_111 — 2010-12-30T03:46:52-05:00 — #3
Thanks r937 that worked. I understand the CHARINDEX part where you are finding the index of where to start from.
Am i right in thinking that the LEN(SI.Location) - CHARINDEX('/', SI.Location, 1) is checking for the slash and removing up to it?
r937 — 2010-12-30T06:31:21-05:00 — #4
sort of, in a way... it's actually just a length calculation
the "removal" is done by the SUBSTRING function