SQL script to get table content as “SELECT * FROM tblname”

我的未来我决定 提交于 2019-12-11 06:42:20

问题


I want to take data base back up, so is there any sql script to take that, like how we use the sql script to get table content as "SELECT * FROM tblname" ,

Thanks in advance


回答1:


Looks like hes talking about SQL Server 2008.

To do a full database backup to File/Query you can use the 'Generate Scripts...' option on the Database.

Open SQL Server Management studio, right click on the database and choose 'Tasks->Generate Scripts...'

Then use the wizard to backup the database. You can script the whole database or parts of it. Two important options: In the 'Advanced' section, you will probably want to ensure 'Type of backup = 'Schema and Data' and the 'Script Statistics' is on.

This will produce a *.sql file that you can use as a backup.




回答2:


What Database?

May be missing what's being asked here but have you looked at each database's backup utility for example mysqldump?

mysqldump




回答3:


Try DBSourceTools.
http://dbsourcetools.codeplex.com
It is specifically designed to script all database objects and data to disk.
You can then place these files under source-code control to effectively take a "snapshot" of the database.
All you need to do then is to define a deployment target database, and DBSourceTools will re-create the target database from source.
It also has a table Data View from which you can generate insert scripts.



来源:https://stackoverflow.com/questions/5078587/sql-script-to-get-table-content-as-select-from-tblname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!