Getting the file extension on SQL Server
Today I had the need to get the extension of a file name I have stored on a table column.
Googled it a bit and ended wrapping the concepts I’ve found and making my own solution:
REVERSE(
SUBSTRING(
REVERSE('filename.pdf'),
0,
CHARINDEX('.',REVERSE('filename.pdf'))
)
)