How to transfer database to text file - and from text file to database in SQL Serv开发者_如何学Goer 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.
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.
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.
精彩评论