prøv dette: declare @str varchar(20)='MyDoc.doc'; select reverse(left(reverse(@str),charindex('.',reverse(@str))-1)) SQL violindemo