Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

bcp argumnet erros

Posted on 2011-02-28
3
Medium Priority
?
281 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 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
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 to return specific rows and columns, with various degrees of sorting and limits in place.

730 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