Wednesday, March 28, 2012

PROBLEM WITH bcp

Hello!!

I have a problem with bcp in Query Analyzer.
The sentence is:

bcp SELECT id_categoria from categorias QUERYOUT 'c:\salida.txt' -c
-Ulogin -Ppassword

With this sentence, the error is:
Line 1: Incorrect syntax near 'c:\SADD.txt'.

PLEASE, I NEED HELP.
THANKSthis command works fine..

bcp "SELECT * from pubs..authors" QUERYOUT "C:\salida.txt" -c -S<server name> -Usa -P<password>

database name, server name and quotes around the query are missing from ur BCP command also the file path should be in full.|||hmmm, doesn't work for me, has a problem around QUERYOUT
strange.

i'll keep looking|||This is true!!, the error now is:
Line 1: Incorrect syntax near 'queryout'.

bcp "SELECT id_categoria from categorias" queryout "C:\salida.txt" -c -S<server_name> -U<login_id> -P<password>|||It works via the OS command line.|||master..xp_cmdshell 'bcp "SELECT * from pubs..authors" QUERYOUT "C:\salida.txt" -c -S<server name> -Usa -P<password>'sql

No comments:

Post a Comment