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 |
|
samaneh
Starting Member
3 Posts |
Posted - 2007-12-26 : 05:25:52
|
| Hello to every bodyI need to know about sequence of execution in a select command.I have a sql command that use a function.some thing like:select id, function(item)from tblwhere conditions...I want to know that if my function on item execute before where section or vise versa.I try to explain it more. I want to know that sql engine fetch rows accordin to where clause and then execute my function or execute my funtion and then fetch the rows according to where clause.If you have a document or some thing that explain about sql engine and sequence of execution please let me know.Your help is really appriciated. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-26 : 06:23:20
|
| SQL Server always processes statement from Right to Left. So in your case the filtered rowset will be retrieved first and then function will be applied to each record. But how does this matter to you?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
samaneh
Starting Member
3 Posts |
Posted - 2007-12-26 : 10:21:11
|
| Hi dear harsh athalyeThanks alot because of your reply.The point here is that my function has written by myself. It's not a sql function. Actually I wrote a function and I want to see the result of execution of that on my data.Does it make any difference in your reply? Is it always true that "where" clause execute before my function?I'm really eager for your reply.and one thing else...Do you have any documentation that explain sql engine functionality? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-12-26 : 10:35:27
|
| where always executes before teh select list.the functions in the select list are excuted on an already filtered resultset._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
samaneh
Starting Member
3 Posts |
Posted - 2007-12-27 : 03:49:59
|
| Thanks spirit1 |
 |
|
|
|
|
|