SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Export Data in Text File Using BCP

By Manish Mathur, 2009/02/11

Total article views: 1881 | Views in the last 30 days: 125

This script export the data in text file from sql server 2005 tables. This script containing stored procedure which required four input parameters as follows :-

@DBName - Pass database name

@TableName - Pass Table name for export

@FilePath - pass valid path with file name

@Separator - pass field separator(if you pass null then it will take ',' as default separator)

In this article i have used bcp command which is required some xm_cmdshell configuration enabled in your server.

To enable to xp_cmdshell on your server execute following script :

RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE

By Manish Mathur, 2009/02/11

Total article views: 1881 | Views in the last 30 days: 125
Your response
 
 
Related tags

BCP    
SQL Server 2005    
 
Related content

What does SMO mean in SQL Server 2005?

(not yet rated) | 2,473 reads

What is database mirroring?

By Steve Jones | Category: SQL Server 2005
(not yet rated) | 2,871 reads

What is the role of a witness in...

By Steve Jones | Category: SQL Server 2005
(not yet rated) | 1,617 reads
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com