SQL max command

I have the follwoing data in the table.

wID
WS-1000
IS-1001
MS-10001

Two letters, a hyphen then number 4 to 5 digits. How can I select the maximum number from the digit part?

thanks

ayha
LVL 7
ayha1999Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
s_chilkuryConnect With a Mentor Commented:
Try:
SELECT @NId = MAX(CAST(SUBSTRING(field, 4, len(field)) as INT))  FROM [table];
0
 
ayha1999Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.