Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update temp tables
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

48 Posts

Posted - 08/19/2013 :  16:37:39  Show Profile  Reply with Quote
I don't know how to update a temp table with another temp table

for example I have #tempdashboard that has info in it.
I also have #tempappscount of which I want to insert the info inside it into #tempdashboard

I believe the column in #tempdashboad is
DailyAppsIn INT,

I did a query that gave me the number of daily apps created. I was told to create #tempappscount and my query to dump into #tempappsaccount. Then dump the info from #tempappsaccount into #tempdashboard.

Clueless but still trying to learn. Thanks

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 08/19/2013 :  16:46:34  Show Profile  Reply with Quote
The basci pattern for inserting from one temp table to another should be:
INSERT #TempTable1
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 08/20/2013 :  05:57:19  Show Profile  Reply with Quote
how to update a temp table with another temp table

would be something like

SET DailyAppsIn =a.appcountfield
FROM #tempappscount a
INNER JOIN #tempdashboard d
ON d.relatedcol = a.relatedcol

relatedcol is column(s) by which two tables are related

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000