Solved

bcp argumnet erros

Posted on 2011-02-28
3
275 Views
Last Modified: 2012-08-13
I keep trying with bcp command , but keep on failing with the same erros

C:\Program Files\Microsoft SQL Server\90\Tools\Binn>bcp TestDBA.dbo.LOggingA queryout G:\December.txt "select * from LoggingA with (nolock) where date_time between  '2010-12-31 23:59:59.99
9' and '2011-01-31 23:59:59.999'"  -S Testserver 4 -T -c -b 100000
Unknown argument 'select * from LoggingA with (nolock) where date_time between  '2010-12-31 23:59:59.999' and '2011-01-31 23:59:59.999'' on command line.
0
Comment
Question by:motioneye
  • 2
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 34998188
you want to do this way:
bcp "select * from LoggingA with (nolock) where date_time >= '2011-01-01' and date_time < '2011-02-01'" queryout G:\January.txt  -S Testserver 4 -T -c -b 100000

Open in new window

0
 

Author Comment

by:motioneye
ID: 34998569
Thanks agneIII it works,
But If I want to have the query in text file and let the bcp call the files what should be the parameter ? any advise ?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35005404
you cannot use a query from a text file when using bcp.
for that, you could use the sqlcmd command line tool
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

914 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

15 Experts available now in Live!

Get 1:1 Help Now