You are not Logged in
Would you like to Login or Register

Today is: Friday, 21 November, 2008
Check this months hot topics

Exporting Large amounts of Data from SQL

If you have ever had an issue transfering large amount of data from SQL you can use the command line tool to solve this problem.

From the command line

bcp [<database_name.>[<owner>].]<table_name> out <csv-file> [/U<username>] [/P<password>] [/S<server_name>] /c /t

<database_name> is an optional parameter specifying the name of the database. It can only be omitted if the desired database is the default database.
<owner> the name of the table owner.
<table_name> the name of the table.
<csv-file> The name of the comma separated file to generate.
<username> The SQL Server username to use. This can be left blank if NT authentication is used.
<password> The password to use for the account.
<server_name> The name of the server on which the database resides. This can be omitted if the database is on the local machine (i.e. the same machine. as the bcp command is issued from).

For example

bcp myDatabase.dbo.MyTable out Output.csv

This is less bulking and a lot faster than using the built in function within Enterprise Manager.

kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Danny Mehmed Skype
Author : Danny Mehmed
Published : Thursday, 31 August, 2006

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views