Friday, February 24, 2012

How to use bcp in at SQL Query analyzer

Dear All,
I need to do bcp in. The command I use at SQL Query
analyzer is
exec bcp 'schedule.dbo.emp_new'
out 'e:\sqlserver_bcp_data\new.out' -SSQLSERVER_TRY1 -Usa -
Ptrytry -c
But I am getting the error message
Server: Msg 179, Level 15, State 1, Line 1
Cannot use the OUTPUT option when passing a constant to a
stored procedure.
So, how to do bcp in. Please help me.BCP is a command line utility, not a T-SQL command. So, try that command
from the command prompt.
You could also invoked such executables from Query Analyzer, using the
xp_cmdshell extended system stored procedure. See SQL Server Books Online
for more information.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Sonia" <anonymous@.discussions.microsoft.com> wrote in message
news:2df0e01c46a5b$46289750$a301280a@.phx.gbl...
Dear All,
I need to do bcp in. The command I use at SQL Query
analyzer is
exec bcp 'schedule.dbo.emp_new'
out 'e:\sqlserver_bcp_data\new.out' -SSQLSERVER_TRY1 -Usa -
Ptrytry -c
But I am getting the error message
Server: Msg 179, Level 15, State 1, Line 1
Cannot use the OUTPUT option when passing a constant to a
stored procedure.
So, how to do bcp in. Please help me.|||Hi,
You have to xp_cmdshell to execute a bcp from query analyzer.
master..xp_cmdshell 'bcp schedule.dbo.emp_new out
e:\sqlserver_bcp_data\new.out -SSQLSERVER_TRY1 -Usa -Ptrytry -c
--
Thanks
Hari
MCDBA
"Sonia" <anonymous@.discussions.microsoft.com> wrote in message
news:2df0e01c46a5b$46289750$a301280a@.phx.gbl...
> Dear All,
> I need to do bcp in. The command I use at SQL Query
> analyzer is
> exec bcp 'schedule.dbo.emp_new'
> out 'e:\sqlserver_bcp_data\new.out' -SSQLSERVER_TRY1 -Usa -
> Ptrytry -c
> But I am getting the error message
> Server: Msg 179, Level 15, State 1, Line 1
> Cannot use the OUTPUT option when passing a constant to a
> stored procedure.
> So, how to do bcp in. Please help me.
>|||Sonia,
bcp is a commandline tool. To use it in QA you need to shell out and run
it using xp_cmdshell. Alternatively use BULK INSERT or DTS - the command
you posted actually bcps out, not in, so you need to change that.
example using xp_cmdshell:
exec master..xp_cmdshell 'bcp schedule.dbo.emp_new out
e:\sqlserver_bcp_data\new.out -SSQLSERVER_TRY1 -Usa -
Ptrytry -c'
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Sonia wrote:
> Dear All,
> I need to do bcp in. The command I use at SQL Query
> analyzer is
> exec bcp 'schedule.dbo.emp_new'
> out 'e:\sqlserver_bcp_data\new.out' -SSQLSERVER_TRY1 -Usa -
> Ptrytry -c
> But I am getting the error message
> Server: Msg 179, Level 15, State 1, Line 1
> Cannot use the OUTPUT option when passing a constant to a
> stored procedure.
> So, how to do bcp in. Please help me.
>

No comments:

Post a Comment