Try: if(index(MyField, 'on srv'), mid(MyField, index(MyField, 'on srv')+3,9),'other') as ServerName
edit: index returns the start position of the first occurence of a search string in a string. If MyField contains 'on srv' then index(MyField, 'on srv') returns a number larger than 0. In that case we know that there's a server number in the string. If there isn't we specify 'other' as result of the if function. To get the server number the mid function is used. It needs a starting position and a length to determine the substring that's extracted from MyField. The starting position in again calculated with the index function, but we add 3 so we start at srv instead of on.