Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
smile
Starting Member
22 Posts |
Posted - 2009-05-09 : 05:56:03
|
| Hello!I want to ask about the priority of execution when using the same table in insert/update query with select. For example:insert into animals(name)select name from animalswhere age > 30;The query is just example...but in what order will the operators be executed? And I'll be very grateful if you give me some link where I can read more about this!Thank you! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-09 : 06:07:44
|
| where condition will be evaluated and it filters records based on condition. the satisfying records will be returned by select which is inserted to table. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-05-09 : 22:37:29
|
| If you are inserting lots of records then you will have blocking when you try to select. |
 |
|
|
smile
Starting Member
22 Posts |
Posted - 2009-05-10 : 18:29:43
|
| I thought that it's possible the "insert" statement to be executed before all the values from the "select" are generated. I mean - does it always execute firstly the "select" statement and then the "insert" one or it depends on the system? If it depends how can I find out what's the order of execution? |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-05-11 : 01:25:16
|
| http://blog.sqlauthority.com/2009/04/06/sql-server-logical-query-processing-phases-order-of-statement-execution/Here may be you get something,,,about this..iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
 |
|
|
smile
Starting Member
22 Posts |
Posted - 2009-05-15 : 17:44:24
|
| Ok, thanks! |
 |
|
|
|
|
|