Solved

BCP - Running a stored procedure from the command line

Posted on 2008-06-19
2
3,445 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
Comment Utility
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
Comment Utility

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now