Solved

bcp argumnet erros

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

747 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

11 Experts available now in Live!

Get 1:1 Help Now