SQL script to get table content as “SELECT * FROM

2019-08-25 03:39发布

问题:

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.