# Database Discussions > Sybase >  call bcp from stored procedure

## mutley

Hi

   How can I call the bcp from Stored procedure and generate text file ?


thank you in advance

----------


## Joe Fung

Hi 

You can run the bcp command through ESP xp_cmdshell. 

For example, inside your stored proc, add the following sql command 

exec xp_cmdshell &#39;bcp dbname..table out filename.bcp .....&#39;


cheers
Joe


------------
mutley at 5/22/2002 11:50:20 AM


 Hi

   How can I call the bcp from Stored procedure and generate text file ?


thank you in advance

----------

