bcp utility



I'm using SQL 2005 to export data. I would like to use the bcp utility
to export data to an Excel file.
I have to generate quite a few files and the names are dynamic. The
ideal would be to loop through records in a stored procedure to create
a file name to use in the bcp. My question is how can I use the bcp
from a stored procedure? I know how to run it from the command prompt.
Is there a way to control the command prompt from a stored procedure?

Thanks all
.



Relevant Pages

  • Re: Need advice on a Data Import Routine
    ... have used is to execute a BCP statement into a properly structured table. ... with security in-line (you specify user.password in the command) and if the ... any parsing required. ... This allows SQL Server to run DOS commands from within a stored procedure. ...
    (microsoft.public.sqlserver.programming)
  • Re: BCP and table variables
    ... The stored procedure that's being executed by BCP is also what creates ... even when I use a global temp table. ... "The query can reference a stored procedure as long as all tables referenced inside the stored procedure exist prior to executing the bcp statement. ...
    (microsoft.public.sqlserver.programming)
  • Re: ISQL is truncating contents of text field sent to text file.
    ... surfaced after some testing to implement BCP usage, ... that conform my stored procedure, will need to find a workaround. ... FOR XML? ... are ignored or not included in the text-file generated by BCP. ...
    (comp.databases.ms-sqlserver)
  • BCP Export auf Basis von STP extrem langsam
    ... Export per BCP auf Basis einer Stored Procedure. ... Wenn wir die Prozedur im Query Analyzer laufen lassen, ... Auf dem Server wird am Weekend jeweils über Wartungsplan eine Optimierung ...
    (microsoft.public.de.sqlserver)
  • Re: bcp error when queryout is stored procedure
    ... BCP tries to get how the result set will look like in order to generate the file format correctly. ... (proc)" you will execute so that the temp table will actually be created, but be aware that the proc ... > Real stored procedure is very large and it populates temporary table through ...
    (microsoft.public.sqlserver.tools)