declare @Str varchar(100);select @Str = '26d5';selectcase patindex('%[^0-9]%', @Str) when 0 then cast(@Str as Int) else nullend;