Results 1 to 10 of 10

Thread: bcp

  1. #1
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61

    Unanswered: bcp

    Any ideas why this wont work?

    bcp {Pic_Count_Import} in \\DATASRVR\InetPub\wwwroot\images\Pic_Count.txt -q -t "," -SDATA -U"aa" -P"blah"

    Thanks

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    drop the squirrelly brackets around the table name and the quotation marks around the user name and password.

    Generally, when I use bcp I explicitly state the table in the form <database name>.<owner name>.<table name>.

    What error message or undesired results are you getting?
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61
    I changed it to this
    bcp dbo.Pic_Count_Import in \\DATASVR\InetPub\wwwroot\images\Pic_Count.txt -q -t "," -SDATA -Uaa -Pblah

    Still I get syntax error near '.'

    Originally posted by Paul Young
    drop the squirrelly brackets around the table name and the quotation marks around the user name and password.

    Generally, when I use bcp I explicitly state the table in the form <database name>.<owner name>.<table name>.

    What error message or undesired results are you getting?

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    from books online, bcp utility, overview:

    -q

    Executes the SET QUOTED_IDENTIFIERS ON statement in the connection between the bcp utility and an instance of SQL Server. Use this option to specify a database, owner, table, or view name that contains a space or a quotation mark. Enclose the entire three-part table or view name in double quotation marks (" ").

    I would suggest dropping the -q argument. Try it and let us know.
    Paul Young
    (Knowledge is power! Get some!)

  5. #5
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61
    Same


    Originally posted by Paul Young
    from books online, bcp utility, overview:

    -q

    Executes the SET QUOTED_IDENTIFIERS ON statement in the connection between the bcp utility and an instance of SQL Server. Use this option to specify a database, owner, table, or view name that contains a space or a quotation mark. Enclose the entire three-part table or view name in double quotation marks (" ").

    I would suggest dropping the -q argument. Try it and let us know.

  6. #6
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    what happens if you add the database name?
    Paul Young
    (Knowledge is power! Get some!)

  7. #7
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61
    Same..


    Originally posted by Paul Young
    what happens if you add the database name?

  8. #8
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61
    Ya know what, this may be a stupid question.. can you use bcp ina stored procedure?

    That is where I am doing this..

    preceded with EXEC bcp.....

    or should I be using BULK INSERT ?

    not sure what the differences are?

  9. #9
    Join Date
    Feb 2002
    Posts
    2,232
    bcp is a command line utility. You can run bcp within a stored procedure but you need to use xp_cmdshell. You should use the bulk insert tsql statement instead - also have you looked at using the bulk insert task in dts ?

  10. #10
    Join Date
    Feb 2002
    Posts
    2,232
    Also know that bcp can import/export while bulk insert can only copy a data file in sql server (one-way only)

Posting Permissions

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