Monday, March 26, 2012
question regarding bcp
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
Saturday, February 25, 2012
Question on connecting to Oracle
Hello all,
I'm using a OLE DB Connection Manager to Oracle (I've installed the client) and using Oracle Native OLE DB Provider.
The problem was the view In Oracle I'm returning a column that uses a fuction on a numeric field in the the select part of the statement, and by this, the Precition is not displayed when I'm trying to look at the data types of the fields in the view.
The Precision is shown as 0 in the external field part of the component.
I have read the previous post concerning the problem connecting to Oracle Using the Oracle provider, and solved it by using the Microsoft provider, but still I have a question about the oracle provider:
I changed the precision on the External column (from 0 to 15) and also an the Output column, but now I'm getting an error on about error output not matching:
Error 6 Validation error. Data Flow Task: OLE DB Source 1 [8970]: The output column "UPDATE_TIME_NUM" (9333) on the non-error output has no corresponding output column on the error output. Dim_registered_user.dtsx 0 0
I cannot change the error output datatype, cannot delete it or do anything at all.
Is there a way to fix the problem?
This may or may not help you, but I've switch my Oracle connections over to the ADO.NET provider for Oracle. The only side effect is that the resulting data flow is Unicode by default...so all your string data is DT_WSTR instead of DT_STR. You can change that, but it's a manual operation go through all the External Columns and change their type.
I had some weird data issues like you describe above and after poking around the internet came across this article by Donald Farmer (http://www.sqljunkies.com/WebLog/donald_farmer/archive/2005/03/13/8819.aspx). That article explains alot about SSIS Oracle issues.
|||The problem with ADO.NET provider is that it doesn't allow the use of variables as a source SQL