Solved

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

Posted on 2014-04-21
2
230 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
[X]
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
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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