0

How can i keep in memory a table created by WITH statement until the end of script?

Example:

;WITH Group AS
(
    SELECT Name, LastName, Age FROM dbo.persons WHERE Age BETWEEN 25 AND 30
)
--Group table stays in memory until the following query
SELECT * FROM Group

--Group does not exist here.
SELECT * FROM Group WHERE AGE = 27

Thanks in advance

CodeArtist
  • 5,534
  • 8
  • 40
  • 65

0 Answers0