meaning

What is the meaning of this. What is happening here


insert into myobjects select * from myobjects;
jeevan mathewdbaAsked:
Who is Participating?
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
You are creating two of every row in myobjects.

In other words: duplicating the data.

You are inserting into one table the results of a select.  In this case, the same table.
0
 
sdstuberCommented:
that is effectively doubling your data.

"select * from myobjects" returns all rows and columns in the myobjects table.

"insert into myobjects" takes the result of the select statement and inserts all of those results into the table


note - if you have unique constraints or indexes on the table then it's likely the insert will fail because of duplicates on every row
0
 
FarWestCommented:
if you are suspicious that it will go for infinite loop, no it will not,
The SQL Processor will fetch all rows before insert and then it will insert those rows
if data is large temp tables are used
0
 
jeevan mathewdbaAuthor Commented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.