Analyze the following code used to update a Common Table Expression:
USE demodb
GO
DECLARE @a TABLE (ID int, Value int);
DECLARE @b TABLE (ID int, Value int);
INSERT @a VALUES (1, 10), (2, 20);
INSERT @b VALUES (1, 100),(2, 200);
WITH cte AS (SELECT * FROM @a)
UPDATE cte
SET Value = b.Value
FROM cte AS a
INNER JOIN @b AS b ON b.ID = a.ID
SELECT * FROM @a
GO
What Will be the output of the above code?
Correct Answer: ID Value ----- ----- 1 100 2 200
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Microsoft SQL Server MCQ Questions