This could be done if you send this HTML (as XML) into function and this function will return table:
CREATE FUNCTION dbo.htmltotable (
@html xml
)
RETURNS TABLE
AS
RETURN
(
SELECT t.v.value('.','nvarchar(max)') as Brand,
t.v.value('@href','nvarchar(max)') as [URL]
FROM @html.nodes('/div/ul/li/a') as t(v)
)
GO
But here comes a problem:
You have class="overbrand" class="navhome" in first <li>. It will throw error duplicate attribute on a moment when you convert your text to XML. So you need to do something with your HTML first.
F.e. if this:
<li class="overbrand" class="navhome"><a href="http://www.laptop-power-adapters.co.nz">HOME</a></li>
is a standard for all pages you can use REPLACE:
DECLARE @x nvarchar(max),
@replacement nvarchar(max) = ' class="overbrand" class="navhome"'
SELECT @x = N'
<div id="naver">
<ul id="naverlist">
<li class="overbrand" class="navhome"><a href="http://www.laptop-power-adapters.co.nz">HOME</a></li>
<li><a href="http://www.laptop-power-adapters.co.nz/acer-laptop-power-adapters.htm">Acer</a></li>
<li><a href="http://www.laptop-power-adapters.co.nz/asus-laptop-power-adapters.htm">ASUS</a></li>
<li class="navspecial"><a href="http://www.laptop-power-adapters.co.nz/contact.htm" target="_blank">Contact Us</a></li>
</ul>
</div>'
SELECT @x = REPLACE(@x,@replacement,'')
SELECT *
FROM dbo.htmltotable(@x)
Output:
Brand URL
HOME http://www.laptop-power-adapters.co.nz
Acer http://www.laptop-power-adapters.co.nz/acer-laptop-power-adapters.htm
ASUS http://www.laptop-power-adapters.co.nz/asus-laptop-power-adapters.htm
Contact Us http://www.laptop-power-adapters.co.nz/contact.htm