I have a temporary table and I would like to create a temporary view over this temporary table.
Is it possible?
In following example I would like #Top10Records
to be a view instead of a table so that I get
select * into #Top10Records from (select top 10 * from #MytempTable)
You can use a Common Table expression to do that:
WITH Top10Records AS
(
select top 10 * from #MytempTable
)
SELECT * FROM Top10Records
GO