Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Im having a database with 500 GB. I have to create a sample database from my original database with the size of 10 GB. In my sample database i need sample of 1000 records from each table from the original database since original database having lakhs of records. Original database tables have constraints and Index i want the same in my sample database tables.

How to create a sample database?
Posted

1 solution

create database your_db_name
select top 100 * into table_name from table_name // use this line for all tables

//better option is that you create an application and inside for loop execute this query
 
Share this answer
 
Comments
kirthiga S 3-May-13 4:34am    
Im having more than 4000 tables in my database. It is not easy to use select * into for all the tables. One more thing i want all constraints and indexes as it is.
Sant Osha 3-May-13 5:23am    
that was i typed also.. create application for that
Sant Osha 3-May-13 5:29am    
you can also use cursor

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900