You are here: Re: bcp utility « MsSQL Server « IT news, forums, messages
Re: bcp utility

Posted by Erland Sommarskog on 11/30/07 22:10

Mike (mckeyes@gmail.com) writes:
> 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?

As Plamen said, you can use xp_cmdshell, but xp_cmdshell is a security
risk and for this reason it is disabled by default. It may be better
to write a small application VBscript or whatever you fancy to run
the export.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация