Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 bcp error:Copy direction must be either 'in', 'out

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2014-05-16 : 15:00:26
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 executeprocess 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

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-16 : 15:41:52
In the output, it's missing the double quotes which are required. I am not sure how to fix the ActiveX script though.

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

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -