Solved

bcp argumnet erros

Posted on 2011-02-28
3
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

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 143

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

752 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