Geoffseymour.Com

December 31, 1969

Extract file name extension from file path using T-SQL

Filed under: 292 — admin @ 6:00 pm

HTTPRequestURIStem is the column contains file path, e.g. /webpage/default.aspx

  1. REVERSE(SUBSTRING(REVERSE(REVERSE(SUBSTRING(REVERSE(HTTPRequestURIStem),0,
  2. CHARINDEX(‘/’,REVERSE(HTTPRequestURIStem))))),0,
  3. CHARINDEX(‘.’,REVERSE(REVERSE(SUBSTRING(REVERSE(HTTPRequestURIStem),0,
  4. CHARINDEX(‘/’,REVERSE(HTTPRequestURIStem))))))))

This function will return “aspx” for “/webpage/default.aspx”.

NOTICE: I put the code in seperate lines for readablity.

Source: chenty

2 Comments »

  1. Hello! Please e-mail me your contacts. I have a question zachary@complective.ru” rel=”nofollow”>……

    Thanks!…

    Trackback by Frankie — June 11, 2010 @ 7:41 pm


  2. MedicamentSpot.com. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. No prescription drugs. Order pills online

    Buy:Cialis Soft Tabs.Viagra Super Force.Viagra Professional.Soma.Propecia.Viagra Soft Tabs.Viagra.Cialis Super Active+.Viagra Super Active+.Maxaman.Cialis.Super Active ED Pack.VPXL.Tramadol.Levitra.Cialis Professional.Zithromax….

    Trackback by RON — July 21, 2010 @ 2:46 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress