Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting into Temp Tables

Status
Not open for further replies.

SeaninSeattle

IS-IT--Management
Sep 17, 2001
53
0
0
US
My brain is totally shot - anyone remember what the syntax is for pulling a ton of data into a temp table? It was something like

Select into #temptablename ...Fieldnames
from ...tablename
where ...constraints

Thanks,
//sse

Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
Quicker if you create the temp table first then populate it with:

create table #temptable (fields)

insert into temptable(fields)
select fieldtrs from physical table

Tim
 
This will also do the trick without need to create the
table, thats if this is what you want. wont work on an existing table then pattycake repsonce will be best

--selecting fields
select OrderId,CustomerID,OrderDate into #temp from Northwind..orders

or

-- All rows
select * into #temp from Northwind..orders
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top