The Query Performance to execute different ways but display cost
value same. The Common table expression to use a Row number to execute the
query sharing the cost value.
CTE Using Row index:
;WITH LegoDet AS
(
SELECT Legoid,
ROW_NUMBER() OVER (ORDER BY Legoid) AS "Row Number"
FROM Lego
)
SELECT * FROM LegoDet where legoid=5984
CTE Using without Row index:
;WITH ProductsCTE AS
( SELECT *
FROM lego
WHERE legoid=5984
)
SELECT * FROM ProductsCTE
Select Query:
select * from lego where legoid=5984
Store procedure :
exec Pro_Lego
0 comments:
Post a Comment