problem with BCP

  • I have never used BCP before and need to create a piped extract from one of our databases. I am entering:

    https://www.sqlservercentral.com/ConfirmRegistration?levm4ZTf0PQ%2fFZM9HcjPaA%3d%3d

    and I get the following error message:

    Server: Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near 'queryout'.

    What am I doing wrong?

    thanks

  • I think you may have copy-and-pasted the wrong string into your post.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • i've used this for pipe delimited; does this help?

    EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT object_name(object_id) As TbLName,name as ColName FROM SandBox.sys.columns ORDER BY object_name(object_id), column_id" queryout C:\Data\Objects.txt -t"|" -c -T '

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • definitely having one of those days.......

    BCP "select * from tier_production.dbo.rpt_PatBalBadDebt" queryout compass.txt -c -T -t "|"

  • yes it does...

  • Just ran this:

    C:\Users\Steve>bcp "select * from db1.dbo.mytable" queryout out.txt -C -T -t "|" -S sevenfalls

    I didn't see a server name in yours.

  • got it working....thanks to all

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply