T-SQL Substring – Last 3 Characters

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 and I need 190


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.

Leave a Reply

Your email address will not be published. Required fields are marked *