Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

copy table

Posted on 2010-09-02
3
Medium Priority
?
594 Views
Last Modified: 2012-05-10
hi, I would like to copy everything from one table to another
eg i_pn into p_pn then m_pn into p_pn
0
Comment
Question by:RVL
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Christopher Gordon
ID: 33590781
Do the table schemas match each other in the tables you're trying to do the copy?
0
 
LVL 14

Accepted Solution

by:
Christopher Gordon earned 2000 total points
ID: 33590815
if schemas match:

insert into p_pn
select * from  i_pn

you'll get an error if they don't match.

if the table doesn't even exist, I usually use the SQL Import Export wizard.
0
 
LVL 22

Expert Comment

by:pivar
ID: 33590850
Hi,

If the table doesn't exist and you want a copy, you can use

select * into p_pn from i_pn

/peter
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

916 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