How do I use bcp to insert into sybase

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bdbeames
    New Member
    • Jun 2007
    • 27

    How do I use bcp to insert into sybase

    Well this is for Sybase, running on server 2003, but this seemed the most relevant place to post

    I have a .txt file with data I would like to insert into a Sybase table.
    I'm new to Sybase, as well as, bcp, could some one give me an example of how to do this.

    I have a table with three columns (a_1,a_2,a_3). Lets say the file name is apple.txt (this is a tab delimitated file). Data looks something like:

    red green yellow
    red yellow green
    green red yellow
    green yellow red
    yellow red green
    yellow green red


    Could some one give be an example of how to insert this into Sybase using bcp.

    I have no clue how to do this. Looking for syntax and any good example you can give me.
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Sorry, I didn't do Sybase for a while and don't have server to test on. So from the top of my head:

    1. Search for bcp.exe on your computer.
    2. Open cmd prompt and change to that direcgtory.
    3. Run something like this:
    bcp database_name.o wner.table_name in datafile -n -U username -P password

    For more info go to:


    or just use Sybase help.

    Good Luck.

    Comment

    Working...