Interesting question... problem lies with figuring out how to match the most specific code to the number. My mechanism uses the length of the Area Code prefix to help figure out the most appropriate one. Note that I have just taken your supplied data and quickly made some CTEs out of it. Just to show you how the SELECT would work...
WITH CalledNumbers AS (
SELECT '98798798797' AS Account
UNION SELECT '19123123123' --I have changed this value from your original post
UNION SELECT '13123123123'
UNION SELECT '12423123127'
), AreaCodes AS (
SELECT '12' AS Prefix, 'Group A' AS GroupName
UNION SELECT '98', 'Group B'
UNION SELECT '1', 'Group A'
UNION SELECT '131', 'Group 5'
UNION SELECT '124', 'Group 4'
)
SELECT CalledNumbers.*, AreaCodes.*
FROM CalledNumbers
LEFT OUTER JOIN AreaCodes ON CalledNumbers.Account LIKE AreaCodes.Prefix + '%'
WHERE LEN(AreaCodes.Prefix) = (SELECT MAX(LEN(Prefix)) FROM AreaCodes WHERE CalledNumbers.Account LIKE AreaCodes.Prefix + '%')
And in order to do your update as required:
UPDATE CalledNumbers SET CalledNumbers.GroupName = AreaCodes.GroupName FROM
CalledNumbers
LEFT OUTER JOIN AreaCodes ON CalledNumbers.Account LIKE AreaCodes.Prefix + '%'
WHERE LEN(AreaCodes.Prefix) = (SELECT MAX(LEN(Prefix)) FROM AreaCodes WHERE CalledNumbers.Account LIKE AreaCodes.Prefix + '%')