I have 3 tables: A, B, C.

How to insert 100000 rows into table B, while inserting have data is the random data are taken from Table A and C

Thanks for help!!!!

Recommended Answers

All 3 Replies

What have you already tried?

Also, you aren't being specific enough to allow any help. Here are some sample questions that might help you refine your request.

Does it have to be truly random? Or can you just cross-join the two source tables and use results from that? Do the source tables A and C have alpha or numeric data? What about the target table B? What columns are of importance for this "random" data?

Does it have to be 1,000,000 rows (like the thread title) or 100,000 rows (like the question)? Or just some large unspecified number? How many rows are in the two source tables?

Are you looking at populating the table for use as test data (as in volume testing or edge-boundary condition testing)? Or is there a specific purpose for generating this data (like production simulation with data masking or obfuscation)?

Sorry I can't be more helpful. Without more detail, I can't provide much guidance.

I will send my sample data to get clearly view on the problem that i need help.

I described my problem:

1. I have 3 tables: Art, Color, Detail which Art and color tables have data (Table Art: Id_Art: int, Art_Name: varchar; Table Color: Id_Color: int; Color_Number: numeric; Color_Name: varchar; Table Detail: Id_Detail: int; Id_Art: int, Id_Color: int, Detail_Content: varchar, Art_Name: varchar, Color_Name).
2. The requirement is that I must creat 1,000,000 rows of data in Table Detail. Data in columns: Art_Name, Color_Name taken randomly from two tables respectively (Column Detail_Content: null)

Best Regards!

Haven't seen your data yet. How many rows in each table? Again, you might just execute a cross-join between Art and Color a bunch of times, until you wind up with a million rows. Of course, you will probably not have completely unique rows (except for Id_Detail) unless you have a sufficiently large number of source rows.

Best of luck!

Be a part of the DaniWeb community

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