Archive

Archive for the ‘PLSQL’ Category

Finding file extension in SQL

June 1, 2010 Leave a comment

Here is the SQL code to find the extension of a file:

declare @appurl varchar(50)
set @appurl= reverse(‘philip.singh.bedi.doc’)

select reverse(LEFT(@appurl, CHARINDEX(‘.’, @appurl) – 1)) ext,
reverse(RIGHT(@appurl, LEN(@appurl) – CHARINDEX(‘.’, @appurl))) fname

Categories: MSSQL, PLSQL