3

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

http://earthexplorer.usgs.gov/browse/etm/1/11/2000/LE70010112000130KIS00.jpg

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.

2

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))
| improve this answer | |
  • 2
    You can click the tick mark to mark this answer as accepted now to indicate this solved your problem – Tom V - try topanswers.xyz Jan 30 '16 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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