Solved

How to copy the content of one temp table into another ?

Posted on 2014-04-21
2
227 Views
Last Modified: 2014-04-21
Suppose in Sql server I have two temporary tables,@temp_table_One, and @temp_table_Two

What I need to do is to copy the contents of temp_table_One into temp_table_Two. How would I do this using Sql? (Assume no data exists in temp_table_Two)


Declare @temp_table_One
(
 id int,
 name varchar(30) null,
 address varchar(150)
)

Declare @temp_table_Two
(
 id int,
 name varchar(30) null,
 address varchar(150)
)
0
Comment
Question by:brgdotnet
  • 2
2 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 150 total points
ID: 40013969
select id, name, address
from @temp_table_One
into @temp_table_Two
0
 
LVL 48

Assisted Solution

by:PortletPaul
PortletPaul earned 150 total points
ID: 40013971
you might want to read this:

INTO Clause (Transact-SQL)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now