hi , I have database 'center' with huge data and wanted to create a dummy 'test' database for 'center' db with 1000 random data for testing purpose. I generated script to copy the db but the resulting 'test' db was tables without data. i need 1000 samples for all the tables.. please help me.. am using MS SQL 2008 R2. thank you.

Recommended Answers

All 2 Replies

You have to prepare an insert script of desired number of records from desired tables.

Why don't you use a select distinct * into newdb.dbo.table from table approach ?
By using

SELECT *
 FROM sys.Tables

you can get a list of all tables. Use this in a cursor and for each table you get use the select .. into.

Edit: To use the select into approach you'll need to script it as a string and use Exec function. If you have a problem post back and I'll prepare something for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.