Got a complex SELECT query, from which I would like to insert all rows into a table variable, but T-SQL doesn\'t allow it.
Along the same lines, you c
You can also use common table expressions to store temporary datasets. They are more elegant and adhoc friendly:
WITH userData (name, oldlocation)
AS
(
SELECT name, location
FROM myTable INNER JOIN
otherTable ON ...
WHERE age>30
)
SELECT *
FROM userData -- you can also reuse the recordset in subqueries and joins