how to find max(varchar field) using sql server

  • The query you posted gives a syntax error... but I see what you are trying to do.

    The reason is is returning 2 is because you are looking for the MAX of a string, not a number. Try something like this:-

    select max(convert(int,substring(bookid,3,8))) from tablename

Viewing post 1 (of 2 total)

You must be logged in to reply to this topic. Login to reply