Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 125 Time: 12:53 - Feb 02, 2009  

mahmoodm7

how do i export my database into a Text file

is there any SQL command to export my database to a text file delimited by comma

Categories

Answer Discussion
Tutorials

 

Suleman

Date:: Jul 16, 2010

Time:: 10:33

Hi Mahmoodm7,

If you are doing this from SQL Server query editor then you would need to run the below command

EXEC xp_cmdshell 'bcp "select col1, col2,col3 from table_name" queryout "C:\results.txt" -S<servername\Instance_name> -U<enter_user_name> -P<enter_password> -t,'


If you want to run this from the command prompt on the server/client/remote server then run this at the command prompt

go to start menu --->run ---type cmd hit enter and copy paste this command and change parameters as per your server and tables/column names and hit enter.

'bcp "select col1, col2,col3 from table_name" queryout "C:\results.txt" -S<servername\Instance_name> -U<enter_user_name> -P<enter_password> -t,



-t is used to specify what is the column delimiter and in this case its ,

admin

Date:: Mar 31, 2012

Time:: 13:57

The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.

The Quomon Team

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es