Skip to main content
Skip table of contents

How to create a MS SQL script that (re)creates table data

For automated testing we need test data. The test data must be (re)creatable at any time.

One way is to export the contents of a database table to an SQL script (for remembering the data) and running that script later for (re)creating the data.

StepDescription
1

Open SQL management studio and select your database

2

Use context menu "Tasks/Generate Scripts..."

Next...

3

"Select specific database objects", e.g. "dbo.WorkflowTemplates"

Next...

4

"Save to new query window" and click "Advanced"

Set "Types of data to script" to "Data only"

Next... Next...

5

Optionally you want to clean the table before inserting?

Then insert a DELETE statement:

Finished! You can save your SQL script to a file and use it to (re)create the table contents.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.