Solved

bcp argumnet erros

Posted on 2011-02-28
3
276 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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…

808 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