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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

temp tables

Status
Not open for further replies.
Apr 6, 2004
33
US
Hello,
I am selecting two columns from a table and grouping on those two columns. I want to put them into a temporary table so I can join that temp table to another table. My question is how do I create a temp table and insert my results to it. Here is what I got so far:
Create table #tempp (job int, subjob int)
insert into #tempp values

Select job, subjob from jcpmst group by job, subjob

Thanks
Tim
 
Drop the values e.g.

Code:
Create table #tempp (job int, subjob int)
insert into #tempp 
Select job, subjob from jcpmst group by job, subjob

Also if you are using the data in the same stored proc try using a table variable - its quicker for smaller sets of data.

"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top