Replacing the Last Three Characters

In a stored procedure, a parameter @input is passed that contains '.htm' on the end.  In the sp I would like to replace the 'htm' with 'doc' and use it as the value of another input.
Is it possible to replace these characters?  They would always be on the end although the beginning of the parameter may contain 'htm' as well.  But I would want to replace the ending characters.
Thank you.
jgcarmichAsked:
Who is Participating?
 
bretConnect With a Mentor Commented:
This will replace the last 4 characters of a string with ".doc":

select @input = stuff(@input, char_length(@input)-3,4,".doc")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.