This is a link I have in a column of a table:


There are like 1000's of rows like this.

  • Is it possible to extract the FileName like LE70010112000130KIS00 (without the path and filename extension) and put it in another column?

I am new to SQL Server.


1 Answer 1


I used this code to extract the FileName with Extension.

UPDATE TableName set ColumnName= right(Image_Link, CHARINDEX('/', REVERSE(ColumnName) + '/') - 1)

And this code to extract and update only FileName

UPDATE TableName  SET ColumnName= REVERSE(SUBSTRING(REVERSE(ColumnName),CHARINDEX('.', REVERSE(ColumnName)) + 1, 999))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.