Last post Oct 25, 2016 09:59 AM by sangad
Oct 25, 2016 06:34 AM|sangad|LINK
I have two table Table1 contains xml type column with value like
and Table to contains id column
I wanted to join these tables by id without cross apply
is any solution to direct join on xml column
Oct 25, 2016 08:57 AM|Chris Zhao|LINK
declare @friends table (id int, name varchar(50))
insert @friends (id, name)
select 2, 'Locke Lamorra'
union all select 6, 'Calo Sanzo'
union all select 10, 'Galdo Sanzo'
union all select 14, 'Jean Tannen'
declare @xml xml
set @xml = '<student><row id="10"/></student>'
from @xml.nodes('/student/row') as table_alias(column_alias)
join @friends f
on table_alias.column_alias.value('(/student/row/@id)', 'int') = f.id
Oct 25, 2016 09:59 AM|sangad|LINK
It works for me