zintech
asked on
SQL Substring to end of string
I would like to do a SUBSTRING statement in SQL that gives me the result of the 2nd character position to the end of the string. However when I try to execute the statement
SELECT SUBSTRING (field1, 2)
It throws an error and places a comma after the "2" like it expects another parameter
SELECT SUBSTRING (field1, 2)
It throws an error and places a comma after the "2" like it expects another parameter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It need a parameter of length (how many chars you want to show). In theory, the best practice would be LEN-1, but you can just overload it and it will return till the end.
Do you mean the 2nd last character in the string?
SELECT LEFT(RIGHT('TheString',2), 1)
SELECT LEFT(RIGHT('TheString',2),
Open in new window