Solved

BCP - Generate CSV from SQL - syntax

Posted on 2011-09-22
3
566 Views
Last Modified: 2012-05-12


I tried

C:\Users\luj>BCP poserv4..vw_posnos out c:\posnos.csv -c -T -t, -S<poserv4> from dos prompt
but i get back..
The syntax of the command is incorrect.

what could be wrong? -T is trusted (windows authentication> -t is to separate by comma
poserv4 is the server name.. i want the results of the view vw_posnos into csv format..
0
Comment
Question by:25112
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Wizilling earned 500 total points
ID: 36584574


Try space after -S
ie. -S posserv4

you are not using the < > in the bcp command, are you?
0
 
LVL 5

Author Comment

by:25112
ID: 36586411
first i was using <>.. i changed it but still fails..
C:\Users\luj>BCP poserv4..vw_posnos out c:\posnos.csv -c -t, -T -Sposerv4
Unknown argument 'ûSposerv4' on command line.

C:\Users\luj>BCP poserv4..vw_posnos out c:\posnos.csv -c -t, -T -S poserv4
Unknown argument 'ûS' on command line.

C:\Users\luj>
0
 
LVL 5

Author Comment

by:25112
ID: 36587432
it must have been a illegible characters.. i typed again slowly and it worked.. thanks Wizilling:
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now