Solved

BCP - Running a stored procedure from the command line

Posted on 2008-06-19
2
3,474 Views
Last Modified: 2008-07-23
I'm trying to run a stored procedure via BCP from the command line
using :-
bcp "exec databaseName.dbo.StoredProcName" queryout c:\export.txt -S serverName  -U userName -P passWord -c -t "," -k

But it doesn't work the error message is :-
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain at least one column
0
Comment
Question by:Pete_Burke
  • 2
2 Comments
 
LVL 17

Expert Comment

by:dbaSQL
ID: 21822365
no, bcp is for copying data to or from sql.  if you want to run a proc, you should use osql.  do you need an example?
0
 
LVL 17

Accepted Solution

by:
dbaSQL earned 125 total points
ID: 21822552

osql /U userName /P password /d databasename /S servername /Q "storedprocname" -o c:\export.txt
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql query to calculate avaerage 21 40
Help creating a spatial object in SQL Server 4 23
Sql Server group by 10 27
VB.net and sql server 4 36
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question