Suppose we have:
假设我们有:
CREATE TABLE #Users(id INT PRIMARY KEY, name VARCHAR(100), suggestions XML);
INSERT INTO #Users(id, name, suggestions)
SELECT 1, 'Bob', N'<Products>
<Product id="1" score="1"/>
<Product id="2" score="5"/>
<Product id="3" score="4"/>
</Products>'
UNION ALL
SELECT 2, 'Jimmy', N'<Products>
<Product id="6" score="3"/>
</Products>';
DECLARE @userId INT = 1,
@suggestions XML = N'<Products>
<Product id="2" score="5"/>
<Product id="3" score="2"/>
<Product id="7" score="1" />
</Products>';
CREATE TABLE #Users