Solved

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

Posted on 2014-04-21
2
224 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
Comment Utility
select id, name, address
from @temp_table_One
into @temp_table_Two
0
 
LVL 48

Assisted Solution

by:PortletPaul
PortletPaul earned 150 total points
Comment Utility
you might want to read this:

INTO Clause (Transact-SQL)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

7 Experts available now in Live!

Get 1:1 Help Now