Solved

copy table

Posted on 2010-09-02
3
586 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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

776 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