Simple: How to copy a Table from one Database to another?

I already know how to do it by creating an identical table and then inserting the Data.
Like so:
SET IDENTITY_INSERT dByDtMinusC5 ON
INSERT INTO [DB1]..T1 ([Id], [HbyD] , [K] )
SELECT [Id], [[HbyD]]] ,[K] FROM [DB2]..T2
As you can see I need to have T1 in order to copy T2 into DB1. Is there any way that I could auto create T1 and copy T2?
There are so many forums in sql server Category, I hope I posted in the right one :0 . We need tag system for forums.   

Hi Bhupinder,
According to your description, you want to copy a table with Primary keys from one database to another database.
As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
References:
Transfer SQL Server Objects Task
Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support

Similar Messages

  • How to Move or Copy the Tables from One Database to Another Database ?

    HI,
          Can any one help me on this, How i can move or copy the tables from one database to another database in SQL server 2005 by using SQL query. Hope can anyone provide me the useful and valuable response.
    Thanks
    Gopi

    Hello,
    Maybe these links help you out
    http://www.microsoft.com/downloads/en/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
    http://www.suite101.com/content/how-to-copy-a-sql-database-a193532
    Also, you can just detach the database make a copy and move it to the new server.

  • How to Copy the PLD from one database to another

    Dear Members,
       i have designed the  PLD for Purchase Order, i want to copy the particular PLD into another Database.
    i tried to copy the PLD from one database to another through copy express.. i copied the PLD sucessfully. But the problem is,it copies all PLD's from one database to another. i want only the Purchaseorder PLD has to be copied in to another database.any body can help me in this regard.
    With Regards,
    G.shankar Ganesh

    Hi,
    select * into A1 from RDOC where Author !='System'
    select *  into A2  from  RITM   where Doccode  in (select Doccode from A1 )
    select * from A1
    select * from A2
    sp_generate_inserts 'A1'
    sp_generate_inserts 'A2'
    you will get Insert scripts of A1 and A2 tables .After that You 'll  Replace A1 to RDOC and A2 to RITM.
    So that you can RUN this SQL srcipts any where (In any Database)
    but First u have to run sp_generate_inserts  Storeprocedure(from websites) .
    drop table A1,A2

  • How to copy the data from one database to another database without DB link

    Good Day,
    I want to copy the data from one database to another database with out DB link but the structure is same in both.
    Thanks
    Nihar

    You could use SQL*Plus' COPY command
    http://technology.amis.nl/blog/432/little-gold-nugget-sqlplus-copy-command
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/apb.htm#sthref3702
    Edited by: Alex Nuijten on Sep 16, 2009 8:13 AM

  • How to copy a table from one system to another system

    Hi all,
            can any one say how to copy table from one system(sys1) to another system(sys2).
    regards,
    nagaraj

    There are many ways.
    1. Use the already existing transaport request number for that table to do the transaport (Active)
    2. Create mannual transport request from SE01 and in the object list enter following
    R3TR -- TABI -- <Table Name>
    And do the transaport.
    3. Ask your basis consultant to do the transaport from oracle layer.
    Thanks,

  • In PL-SQL copy a table from one database to another

    I am currently working on a VB app where I need a way to archive tables from the running database to an archive database. I was hoping to do this with a stored procedure. Thanks for any suggestions in advance.

    AFAIAA there is no equivalent of the SQL*Plus copy command, but it is realtively simple to build such a thing in PL/SQL using DBMS_SQL or EXECUTE IMMEDIATE to issue the necesssary INSERT INTO table@archive_db select * from table;It's simple to create the table in the archive db , you just test for it's exist using %SQLFOUND.
    If you want it fancier, eg. changing the tablename dynamically that's also easy.
    rgds, APC

  • How to copy system table from one client to another client

    Hi,
    Currently i am implementing recruitment module in one of the power sector company. I have finished all the configuration in one of the client in development server. I have trasported all the request in Qulaity server so that i can do the testing. When i am running TCode : PBA7 (Direct Data Transfer) i am getting a runtime error with error analysis -
    A SELECT, UPDATE, or DELETE statement contains the invalid table
    name "PB0021".
    I have checked this system table in this client (Quality Server) but this table is not available, but at the same time this table is available in Devepment server client where i can run this transaction.
    Requiring your help on this to resolve this issue. Do i need to copy this system table PB0021 from Development server client to Quality server client? If so then how to do this activity?
    Thanks in advance....
    Regards,
    Milind

    Hi Milind,
    Goto SE01.
    Create a workbench request manually.
    Add the following entry.
    R3TR TABL PB0021.
    Transport the request to quality system.
    Hope this works.
    Best wishes,
    Dilek

  • Copying a table from one databse to another

    Hi,
    I used the following code to copy a table from one database to another.
    set copycommit 1
    set arraysize 1000
    copy from username/passwd@tnsname -
    create <tablename> -
    using -
    select * from <tablename>
    But I get the following error:
    set copycommit 1
    ERROR at line 1:
    ORA-00922: missing or invalid option
    Could you please let me know how this can be done.
    Thanks,
    Narasimhan

    Thanks for your suggestions.I created a database link.I had no problems.
    Then when i issue the command
    copy from uname/password@db
    create <tablename>
    using
    select * from <tablename>
    <Here db is database link to source database identified by uname and password>.
    I still get the error
    copy from uname/password@db
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    Does it mean that the command is wrong?Or I'm doing something different.
    Thanks!

  • To copy table from one database to another

    hai,
    I will be really pleased if someone can me tell me that how can i copy table from one database to another. I am having two databases.
    Gursimran

    You can Also do
    ++ Create a database link on the TARGET to SOURCE
    CREATE PUBLIC DATABASE LINK <<DBLNK_NAME>> CONNECT TO <<USER>> IDENTIFIED BY <<PASSOWORD>> USING '<<TNS_NAME>>';
    ++ And copy as below
    CREATE TABLE EMP AS SELECT * FROM EMP@DBLNK_NAME;

  • 10g express, scheduled copy of table from one db to another

    Hi,
    I don't know much about Oracle and was hoping if someone could shed some light on how we could implement our solution.
    Our scenario is as follows:
    For a new customer we are going to have 35million records per month coming into the database.
    What we had normally been doing in MSSQL, is creating a new table every month and writing the records in here (although we never had 35 million records before).
    The problem is, I want to archive these old monthly tables in order to save space. I don't know enough about the Oracle suite to see if there is already a program that we can schedule every month to move this table from one database to another. I was initially doing it by code, but this ends up taking 3 hours to copy... something we cannot afford.
    Is 35 million records too much to hold in a table? Should we be partitioning this down even more? I don't know where the threshold is before Oracle craps out.
    Or, maybe a better idea is to create a new database and just store new entries in a new database every month... this way we won't need to copy anything. To me, this sounds stupid though as i don't want to have 60 databases kicking around in five years.
    I'm a developer and no DBA, no one here is a DBA. We're trying to evaluate if our application is going to work on a Oracle platform all without knowing anything about it. Please help!
    Thanks,
    Kevin
    Message was edited by:
    user518940

    Kevin, you definately have the right database for 35M records/mth.
    From your post, it sounds like you need to retain the records in a database for 5 years (yes?). I don't know of any size limitation for Oracle outside of the OS. I don't think your solution should be multiple databases unless you have vastly different needs for the database that can not be satisfied with one instance - ie. OLTP vs. BATCH/OLAP...
    I don't fully understand what you are shooting for because it doesn't sound like you are going to save on any space just by moving the data from one database to another, the records will still require a similar amount of space unless compressed on another database. In either case, unless you can't, I would recommend a single database design. If you need high performance querying the data, and you query it by a specified period of time - ie month, I would recommend using enterprise edition with partitioning (seperately licensed). This would allow you to create a partitioned table where you could partition the table by month. As long as you don't create unnecessary global indexes, the performance should be quite similar to querying/inserting/appending into a table just containing 1 months records. Each partition can be placed in its own tablespace/datafile(s).
    If you absolutely must 'transport' the data to another instance (which I would strongly suggest that you should load it there in the first place unless business rules, performance limitations or something else simply don't allow it), you can use 'transportable tablespaces' and simply ftp the entire datafile to another Oracle database and attach it thus avoiding having to reload it. If it's truly historical you can just leave it ReadOnly. If you want to be tricky about it, you could try to make it part of a partitoned table on the new host.
    I hope I've helped just a little bit. If you need additional help, email me directly at LenLopez AT Yahoo DOT com

  • How to copy OVD configuration from one machine to another?

    We have two machines with OVD servers on them. The configurations should be identical from one machine to the other. We suspect there is a problem with the configuration on one of them. We need to know how to copy OVD configuration from one machine to another.
    Can you tell us how to do that?

    well i have this in mind which may help you.
    You would need to have a public ip address to the machine you have consoled to and on internet.
    Download the tftp software from below link.
    http://tftpd32.jounin.net/
    This software does not only act as the tftp server but also you can select the interface of you ethernet card as tftp server ip address.
    For ex if you are connected to a console and have a wireless card which is connected to internet also you connect you eth lan card to the eth or fast eth of the router.
    you can select which ever interface you want to act as the tftp server.
    you will need to add ip addres for you lan card and also config the router port as same if needed.

  • How to copy List item from one list to another using SPD workflow using HTTP call web service

    Hi,
    How to copy List item from one list to another using SPD workflow using HTTP call web service.
    Both the Lists are in different Web applications.
    Regards, Shreyas R S

    Hi Shreyas,
    From your post, it seems that you are using SharePoint 2013 workflow platform in SPD.
    If that is the case, we can use Call HTTP web service action to get the item data, but we cannot use Call HTTP web service to create a new item in the list in another web application with these data.
    As my test, we would get Unauthorized error when using Call HTTP web service action to create a new item in a list in another web application.
    So I recommend to achieve this goal programmatically.
    More references:
    https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
    https://msdn.microsoft.com/en-us/library/office/dn292552.aspx?f=255&MSPPError=-2147217396
    Thanks,
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to Copy (or) Transfer data in a BLOB Table From one database to another

    Dear Members,
    I want to Copy or Tranfer the data in a Table having BLOB Column from one database to another database.
    The Problem is that I am using COPY Command.
    COPY from scott/[email protected] to k5esk_ldb2/k5esk_ldb2@k5_ist.world CREATE BLOB_TABLE using select * from BLOB_TABLE;
    This is working only if the table is not having BLOB Column or CLOB columns.
    Is there any other way to do the same.
    Appreciate any Help.
    Regards
    Madhu K

    You could try using export/import utilities, but may run into tablespace issues if the tablespaces are not the same between the two databases. You can also try Data Pump using the REMAP_TABLESPACE variable if you tablespaces are different. You could also write your own export and import code...there are plenty of examples of that to copy.

  • How to copy a table from one text frame to another...

    Is there a way to copy a table from one text frame to another? I'm using JavaScript. The following will move a table from one text frame to another, but I need to copy.
    var srcFrame = document.textFrames.item("section-template");
    var dstFrame = document.textFrames.item("test");
    srcFrame.characters[0].move(LocationOptions.before, dstFrame.insertionPoints[0]);
    Thanks,
    Mike-

    Hi Bhupinder,
    According to your description, you want to copy a table with Primary keys from one database to another database.
    As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
    Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
    To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
    and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
    References:
    Transfer SQL Server Objects Task
    Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How To Copy Selected Music From One Library to Another?

    What is the best way to copy selected music from one library to another?
    I have a big and growing iTunes library -- 33,000 songs.
    A year ago I copied my library to my daughter's new iMac.  Now, a year later, I'm off to visit her and wonder how best to update her library.  In the past year I have added a number of items to my library and I'm sure she has done the same -- some might be the same but many will be different.
    How do I update her library with the new things I've added in the past year but not wipe out things she had added or duplicate when we each have a song?
    I can load any / all of my stuff on an external HD and take that to plug in to her computer.  Then what?  I want to avoid duplicates and make sure I get stuff like album artwork.
    I'm running iTune 10.4 on an iMac with OS X 10.6.8 -- my daughter will have the same iTunes and OS X once we update her software.
    Any advice would be great.
    Thanks

    If you're sharing the same Apple ID and all your songs are from the iTunes Store, it's easy:
    In iTunes on your computer, go to File->Preferences->Store and check the box next to MUSIC under AUTOMATIC DOWNLOADS.
    You should also read this article, the section titled TO DOWNLOAD PREVIOUSLY PURCHASED APPS, BOOKS, MUSIC, OR TV SHOWS TO YOUR COMPUTER:
    http://support.apple.com/kb/ht2519
    You could also use an rsync utility such as backuplist+ to perform a 2-way sync of the files in your two libraries while your computers are connected via FireWire with one of them in FireWire Target Disk Mode, or from your external hard drive with your daughter's computer and then to yours again. After that, you'll need to use iTunes on each computer to update its library with the new files:
    http://rdutoit.home.comcast.net/~rdutoit/pub/robsoft/pages/backup.html
    This last would also be the preferred method if you have authorized each other's computers for media purchased with each other's Apple IDs (i.e. you are not sharing the same Apple ID), or if you have music from sources other than the iTunes Store. Most likely, though, music from sources other than the iTunes Store would not be legal to copy in this way for this purpose, although there is probably no technical impediment.

Maybe you are looking for