How to Convert HTML Table in SQL Table using TSQL
DECLARE @Xml xml
set @Xml='<tr>
<td>Vikas
Ahlawat</td>
<td>MCA</td>
<td>28</td>
</tr>
<tr>
<td>Ashwani</td>
<td>MCA</td>
<td>29</td>
</tr>'
T-SQL QUERY TO GET THE ABOVE HTML TABLE VALUE AS A SQL TABLE
SELECT Name = T.C.value('(./td)[1]','varchar(100)'),
Education
= T.C.value('(./td)[2]','varchar(100)'),
Age
= T.C.value('(./td)[3]','varchar(100)')
FROM @Xml.nodes('(/tr)') as T(C)
Result:
Comments