Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Location
    USA
    Posts
    33

    Question Unanswered: BCP Multiple Tables in a database URGENT!!!

    Hi Folks,
    Here is a senario i have three tables T1, T2 and T3 in database D1 how do i use the BCP to export then to import the same data into sybase in one shot i dont want to issue the BCP command thrice.

    This is just an example i have to export/import 700+ tables

    Please Help
    Its very Urgent
    A friend in need is a friend in deed

  2. #2
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524
    Not possible without using the bcp several times. Bcp only impact one table.

    To generate the script executing the exportation
    Code:
    SELECT "bcp "+db_name+".."+name+" out "+name+".bcp -Usa -Pxxx -n -S"+@@servername
    FROM sysobjects
    WHERE type="U"
    To generate the script executing the importation
    Code:
    SELECT "bcp "+db_name+".."+name+" in "+name+".bcp -Usa -Pxxx -n -S"+@@servername
    FROM sysobjects
    WHERE type="U"
    For a whole DB, you can perform a dump/load if the target and the source are in the same operating system AND if the size of the source DB is lower or egal of the size of the target DB

  3. #3
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    If you are thinking of saving space, then you can use Unix Named Pipes.

  4. #4
    Join Date
    Jan 2004
    Location
    Munich/Germany
    Posts
    12

    Wink

    Hi,

    I would be careful with -n option, as the purpose of the particular BCP operation is to do a cross platform data transfer, use -c instead.




    Originally posted by fadace
    Not possible without using the bcp several times. Bcp only impact one table.

    To generate the script executing the exportation
    Code:
    SELECT "bcp "+db_name+".."+name+" out "+name+".bcp -Usa -Pxxx -n -S"+@@servername
    FROM sysobjects
    WHERE type="U"
    To generate the script executing the importation
    Code:
    SELECT "bcp "+db_name+".."+name+" in "+name+".bcp -Usa -Pxxx -n -S"+@@servername
    FROM sysobjects
    WHERE type="U"
    For a whole DB, you can perform a dump/load if the target and the source are in the same operating system AND if the size of the source DB is lower or egal of the size of the target DB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •