A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi @Sudip Bhatt ,
Please have a try with below:
;with cte as (
SELECT d.v.value('(Period/text())[1]','VARCHAR(MAX)') AS Period
FROM @DistinctPeriods.nodes('/Root/NewPeriodData') AS d(v))
select * from cte a
inner join table1 b on a.Period=b.Period
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.