@bobnoordam

SQLServer table variables

table variables live in tempdb but are created at the declaration and dropped at the end of the batch. This is a nice alternative to temptables if you do no need access to the temporary data from multiple sessions, queries or sources, and frees you from the managent of temptables.

Basic format:

declare @work as table (
	customer nvarchar(10),
	name nvarchar(150)
)
insert into @work(customer, name) 
	(
		select code, name from someTable
	)

select top 100 * from @work;