Solved

BCP - Running a stored procedure from the command line

Posted on 2008-06-19
2
3,503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…
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

726 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