Select max int from varchar column

前端 未结 9 1243
离开以前
离开以前 2021-02-19 04:07

I am trying to retrieve the largest number from a varchar column that includes both numbers and strings. An example of the data I\'m working with:

BoxNumber

9条回答
  •  一个人的身影
    2021-02-19 04:42

    Look into casting the column to an int, then selecting the MAX(). I don't know what it will do to columns that contain letters, but it's worth exploring.

    http://doc.ddart.net/mssql/sql70/ca-co_1.htm

提交回复
热议问题