Anton  Zimm
Anton Zimm

Reputation: 420

sql script from base

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 = '[email protected]')...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', '[email protected]')

Upvotes: 0

Views: 163

Answers (1)

george.zakaryan
george.zakaryan

Reputation: 980

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.

Upvotes: 0

Related Questions