Visual Studio 2010 generates SQL Server test data

Source: Internet
Author: User
Tags generator generator generator visual studio 2010

1. Create a SQL Server 2005 database project

First, open Visual Studio 2010, select New Project, and in the, select Build a SQL Server 2005 database project named Database1


2. Import data
Right-click in the database project and select "Import Data Objects and Settings" from the menu that appears, such as:


This will open a Data Import wizard window, for example, will prompt the user to connect to the existing database, we just need to follow the wizard to complete the steps.


Select the data you want and test it:


After the data import is complete, the following message appears indicating that the data was imported successfully.


3. Add Data generation plan
At this point, we can start adding a data generation plan. In the project, after the right mouse button, in the pop-up menu, select data generation plan, such as:



4. Select a table to add test data to
The tables that are already in the database are then available for the user to choose which tables to generate data from, and when the user selects a table, all the columns in the table are displayed below the screen for the user to select which columns to generate the data from.

Find the table that you want to import data from, such as:


Right-click on the column to locate the Properties window, such as:


Specific information is as follows:

Below the section of the column, note that each column in the generator generator can even be set using regular expressions to generate data, such as:


5. Generate Data
Once the above steps are complete, click F5 to randomly generate test data in the datasheet, and at build time, you will be asked whether you want to generate test data in existing database tables or choose a different destination for the build.

The effect is as follows:



Viewing the generated data can also be viewed directly in VS2010:


Small bet

can also be associated with the table to generate test data, temporarily no test, you can search the Internet Information

The table statement is as follows:

CREATE TABLE tb_testtablecomplex200--Creating tables (ID int identity (primary) key, UserName nvarchar (+) NOT NULL, USERNAME1 NV Archar (+) not null, userName2 nvarchar (+) not null, UserName3 nvarchar (+) not null, userName4 nvarchar (+) not NULL, US ErName5 nvarchar (+) not null, UserName6 nvarchar (+) not null, UserName7 nvarchar (+) not null, UserName8 nvarchar (+) No t null, UserName9 nvarchar (+) not null, UserName10 nvarchar (+) not null, userpwd nvarchar (+) not NULL, userPWD1 nvarcha R (userPWD2) not null, nvarchar (+) not null, userPWD3 nvarchar (+) not null, userPWD4 nvarchar (+) not NULL, userPWD5 n varchar (+) not null, userPWD6 nvarchar (+) not null, userPWD7 nvarchar (+) not null, userPWD8 nvarchar (+) not NULL, user PWD9 nvarchar (+) not null, userPWD10 nvarchar (+) not null, userPWD11 nvarchar (+) not null, userPWD12 nvarchar (+) not n ull, userPWD13 nvarchar (+) not null, userPWD14 nvarchar (+) not null, UserEmail nvarchar (+) null)

SQL generates test data:

Click to open link


Visual Studio 2010 generates SQL Server test data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.