Hi ,
I am executing the following command from query analyzer. It is
successfull but i couldnot see the output file. I am connecting to the
database server from my workstation through query analyzer.
exec master..xp_cmdshell 'bcp "SELECT * FROM pubs..authors ORDER BY
au_lname" queryout C:\authors.txt -U sa -P xyz -c'
Here is the output,
NULL
Starting copy...
NULL
23 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 16 Avg 0 (1437.50 rows per sec.)
The problem is i dont know where the output file is. Will it be in the
database server?. If so, then how can i save the output file in my
workstation.
Thanks in advance,
Vel.If you run BCP on the server it can only output to a location that it
can access from the server. Either output to a shared folder that can
be seen by both you and SQL's service account OR run BCP locally on
your workstation (from the command line).
David Portas
SQL Server MVP
--|||The command is executed on the server. If you want the file to be created on
the client, you need to
specify that, use an UNC drive for the client. the service account for SQL S
erver need permissions
for the share. I have a feeling that this isn't the best way to achieve this
, though. What about
having your client application create the file? Or what about executing BCP
on the client computer
instead of through xp_cmdshell on the server?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"velmj" <velmj@.discussions.microsoft.com> wrote in message
news:A3FC958F-EC28-494F-AFDA-70497218DD69@.microsoft.com...
> Hi ,
> I am executing the following command from query analyzer. It is
> successfull but i couldnot see the output file. I am connecting to the
> database server from my workstation through query analyzer.
>
> exec master..xp_cmdshell 'bcp "SELECT * FROM pubs..authors ORDER BY
> au_lname" queryout C:\authors.txt -U sa -P xyz -c'
> Here is the output,
> NULL
> Starting copy...
> NULL
> 23 rows copied.
> Network packet size (bytes): 4096
> Clock Time (ms.): total 16 Avg 0 (1437.50 rows per sec.)
> The problem is i dont know where the output file is. Will it be in the
> database server?. If so, then how can i save the output file in my
> workstation.
> Thanks in advance,
> Vel.|||The file should be in the root drive of the server where you saved it.
You might want to save it somewhere to a less "critial" folder than the
root drive. You can copy it across the network once you are done. Or you
can use the command-line BCP program right from your client and have the
final file automatically saved locally.
David Gugick
Imceda Software
www.imceda.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment