0

How to transfer database to text file - and from text file to database in SQL Server 2008

I try something like: select * into 'd:\test.txt' from men

but it doesn't work.

  • i need it in query solution not in the sql-server backup or similar tool.

2 Answers 2

1

A. better use backup to do it.

B. There are tools that generate a "create" script for an entire database (like TOAD in commercial version).

What exactly are you trying to achieve ?

If you want to code this - you can select the table into a data reader, and then for each row append it to a text file.

Sign up to request clarification or add additional context in comments.

Comments

0

SQL Server Management Studio: "Tasks -> Back Up" or "Tasks -> Generate Scripts" or "Tasks -> Export -> Flat file destination".

Alternatively you could use the bcp.exe command line tool.

1 Comment

i need it in query solution not in the sql-server backup or similar tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.