Results 1 to 3 of 3

Thread: BCP out

  1. #1
    Join Date
    Jan 2012
    Posts
    52

    Unanswered: BCP out

    Hi guys,

    I need help with bcp out. I have been able to export the data from a table into a .txt file. However the way I did it export the whole columns of the table into a .txt file.
    What I want is to export only certain columns, does anyone know how to do this.

    This is what I have in my bcp script:

    @echo off
    bcp TestDB3.dbo.exp_data out "Z:\Export_Data_.txt" -c -t, -T -S Dasasas1T\ABCTEST -U OWNER
    pause

  2. #2
    Join Date
    Jan 2012
    Posts
    52
    I cam with this, but is still wrong any ideas?

    bcp TestDB3.dbo.EXP_DATA "SELECT COMPANY, CURRENCY, ACCOUNT, AMOUNT, EXTDIM1, EXTDIM2 from EXP_DATA" queryout "Z:\exported.txt" -S servername -U owner -T -c

  3. #3
    Join Date
    Jan 2012
    Posts
    52
    A bit of searching and trying did the stuff what I did was the following:

    bcp "SELECT COMPANY, CURRENCY, ACCOUNT, AMOUNT, EXTDIM1, EXTDIM2 from databasename.dbo.EXP_DATA" queryout "Z:\exported.txt" -S servername -U owner -T -c
    Last edited by buzmay; 01-24-12 at 09:19.

Posting Permissions

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