Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    20

    Unanswered: urgent , BCP uTILITY

    how to use BCP command for loading table data ino Text File . I am using as below.

    bcp "SELECT * FROM TFM820_CSH_TRN_HIST WHERE TFM820_CSH_TRN_HIST.IMPRT_IND = 'Y' " queryout 'c:\temt.txt' -n -T

    I am getting this below error

    Line 1:
    Incorrect syntax near 'queryout'.

  2. #2
    Join Date
    Feb 2002
    Location
    Willy is on vacation
    Posts
    1,208
    You cannot have SARG in bcp. BCP does not understand T-SQL.

    If your requirement is to bcp out based on a criteria, then create a view for that criteria and bcp out the view

  3. #3
    Join Date
    May 2005
    Location
    Paris
    Posts
    46
    hi,
    you could try this syntax :

    bcp database..table out "file.txt" -Uuser -Sdataserver_name -c -r"\n" -t";" -Ppaswword -b5000

    for example...

    have a look here : http://manuals.sybase.com/onlinebook...webSearchAll=1


    bcp
    Description

    Copies a database table to or from an operating system file in a user-specified format. bcp is located in $SYBASE/$SYBASE_OCS/bin.

    Windows NT

    The utility is bcp.exe, and is located in %SYBASE%\%SYBASE_OCS%\bin.

    Syntax

    bcp [[database_name.]owner.]table_name [:slice_number] {in | out} datafile
    [-m maxerrors]
    [-f formatfile]
    [-e errfile]
    [-F firstrow]
    [-L lastrow]
    [-b batchsize]
    [-n]
    [-c]
    [-t field_terminator]
    [-r row_terminator]
    -U username
    [-P password]
    [-I interfaces_file]
    [-S server]
    [-a display_charset]
    [-z language]
    [-A packet_size]
    [-J client_charset]
    [-T text_or_image_size]
    [-E]
    [-g id_start_value]
    [-N]
    [-X]
    [-K keytab_file]
    [-R remote_server_principal]
    [-V [security_options]]
    [-Z security_mechanism]
    [-Q]
    [-Y]

Posting Permissions

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