Copying data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saiprasanthi
    New Member
    • Oct 2006
    • 7

    Copying data

    Hi,

    Can you please guide how to copy some of the columns of a table in one server to another table whiich is in a different server.

    Thanks in advance.

    Prasanthi
  • nedu
    New Member
    • Nov 2006
    • 65

    #2
    Hi,

    Please let me know whether u need to insert some columns in a table to the another table from different server. Then use the following.

    Insert into SERVER2.DBNAME. DBO.TABNAME (Col1,Col2,Col3 )
    Values(Select Col1,Col2,Col3 from SERVER2.DBNAME. DBO.TABNAME)

    Thanks,
    Nedu. M

    Comment

    • nedu
      New Member
      • Nov 2006
      • 65

      #3
      Hi,

      This is the exact code . Run this in the destination server.

      Insert into Table_Name(COl1 ,Col2)
      Select COl1,Col2 from ServerName.DBna me.DBO.TableNam e

      Let me know for any other queries . . .

      Thanks,
      Nedu. M

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        if your target table is not existing and will be created by this process, try:

        Code:
        select field1, field2 , field3
        into server2.db2.dbo.table2
        from server1.db1.dbo.table1
        consideration:
        1. rights
        2. if the target table is already existing, you could either drop it first or truncate it ( as necessary) and do an insert instead (see above suggestion)
        3. server should be linked.


        -- CK

        Comment

        Working...