Question

The data generation tool that comes with Visual Studio allows you to populate tables with random/patterned data. As an example, you can tell it to populate an Employees table with 50,000 rows and you can tell it to add 5 address rows to an Addresses table for each Employee row.

I've got a junction table much like the permissions example referenced in this Wikipedia article. Pseudo code below...

create table Users (
  UserId int primary key,
  Username varchar(50)
)

create table Permissions (
  PermissionId int primary key,
  Description varchar(50)
)

create table UserPermission (
  UserPermissionId int primary key,
  UserId int, -- foreign key to Users
  PermissionId int -- foreign key to Permissions
)

Is it possible to use Visual Studio's Data Generation tool to populate Users, Permissions, and the associated junction table?

Using the GUI, I am only able to populate one of the two related tables by selecting it from the Related Table dropdown for the junction table.

Was it helpful?

Solution

This is a pretty good tool that allows you enforce foreign key referencial integrity when populating data. Give the trial a try, maybe it will do what you need...

http://www.red-gate.com/products/sql-development/sql-data-generator/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top