0

in my project database model is changed periodically, but since database contains test data they have to re-enter each time. script to insert data quickly becomes relevant. at the moment it is done manually. how this can be done using sql management studio? I need a script with the data from the tables (to insert ready data to a new table), the script for the database model I have.

for example: i have table [dbo].[Users], table has 3 column [Id],[Login],[Email] and currency contain only one user(Id = 1, Login = 'Anton', Email = 'fake@mail.com')...i create script for my base and resul will be somthink like this

CREATE TABLE [dbo].[Users] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Login] decimal(1024)  NOT NULL,
    [Email] nvarchar(1024)  NOT NULL,
);

INSERT INTO Users([Id],[Login],[Email]) VALUES(1, 'Anton', 'fake@mail.com')
Anton Zimm
  • 420
  • 4
  • 14
  • Maybe you can try to use bcp to export the data as flat files, and bcp again to import them when you start with a fresh database? I'm not sure if this answers your question. – Giscard Biamby Sep 28 '12 at 23:54

1 Answers1

0

There's actually a standalone official tool with which you can create schema and data dumps as sql scripts. Just follow the wizard and make sure you've set the checkbox to export data. As far as I know, it comes included into SQL Management Studio 2008 or later.

george.zakaryan
  • 960
  • 1
  • 6
  • 18