If you go from 160, your last word will be that . If you go over 165, your last word will be looks . Here you can do it with 160:
declare @string varchar(1000) select @string = 'This string is very large, it has more then 160 characters. We can cut it with substring so it just has 160 characters but then it cuts of the last word that looks kind of stupid.' SELECT SUBSTRING(@string, 1, charindex(' ',@string,160)-1)
Note. This will result in an error with lines less than 160 characters. See Martin Smith's answer for handling this situation.
source share