When i run a MAX function it returns me the RC999 record when it should be returning me the 1001 records. Is there a way to run the Max function and skip the first 2 letters of the record?
DECLARE @Test Table (MyField varchar(10))
INSERT INTO @test VALUES('RC1')
INSERT INTO @test VALUES('RC1001')
INSERT INTO @test VALUES('RC999')
SELECT MAX(CONVERT(int, SUBSTRING(MyField,3,500))) AS test
FROM @test
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.