开发者

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

开发者 https://www.devze.com 2023-02-02 19:21 出处:网络
How to transfer database to text file -and from text file to database in SQL Serv开发者_如何学Goer 2008

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号