Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

bcp error: Copy direction must be either 'in', 'out' or 'format' Expand / Collapse
Author
Message
Posted Friday, May 16, 2014 1:32 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, May 16, 2014 1:32 PM
Points: 1, Visits: 1

Good evening, i need your help please,Im tryng to modify and ExecuteProcess Task in a DTS in order to export a portion of a table and not the whole one.

Initially read some parameters in an activex script and then passes to a batch file by means of en excuteprocess task:

the original batch file content is this:
bcp %1 out %2 -c -t"|" -Straficosql -T -- works ok

i tried to modify its content as this:

bcp "select * from %1 where %3 >= %4 and %3 <= %5" queryout %2 -c -t"|" -Straficosql -T
i run the above batch file yielding an error:Copy direction must be either 'in', 'out' or 'format'
the output is this:

C:\WINDOWS>bcp select * from TRAFICO1.dbo.HECHOS_TRAFICO_DATOS_PREPAGO_201308_5338_5347 queryout \\trafico\Historicos_Tablas\PLANOS_TRAFICO\HECHOS_TRAFICO_DATOSPREPAGO_201308_5338_5347.txt -c -t"|" -Strafico\traficosql -T
Copy direction must be either 'in', 'out' or 'format'.
usage: bcp {dbtable | query} {in | out | queryout | format} datafile

dont know if its a syntax error or because of double quotes between select statements
Thanks for your help in advanced
Post #1571889
Posted Friday, May 16, 2014 1:50 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 3:37 PM
Points: 3,374, Visits: 7,300
Put the query and file between double quotes and it should work.
bcp "select * from TRAFICO1.dbo.HECHOS_TRAFICO_DATOS_PREPAGO_201308_5338_5347" queryout "\\trafico\Historicos_Tablas\PLANOS_TRAFICO\HECHOS_TRAFICO_DATOSPREPAGO_201308_5338_5347.txt" -c -t"|" -Strafico\traficosql -T



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1571894
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse