T-SQL Substring - Last 3 Characters

前端 未结 5 379
野趣味
野趣味 2021-01-31 07:01

Using T-SQL, how would I go about getting the last 3 characters of a varchar column?

So the column text is IDS_ENUM_Change_262147_190

5条回答
  •  隐瞒了意图╮
    2021-01-31 07:38

    SELECT RIGHT(column, 3)
    

    That's all you need.

    You can also do LEFT() in the same way.

    Bear in mind if you are using this in a WHERE clause that the RIGHT() can't use any indexes.

提交回复
热议问题