[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


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

Posted on 2014-04-21
Medium Priority
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)
Question by:brgdotnet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 49

Accepted Solution

PortletPaul earned 600 total points
ID: 40013969
select id, name, address
from @temp_table_One
into @temp_table_Two
LVL 49

Assisted Solution

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

INTO Clause (Transact-SQL)

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 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