|
Posted by B D Jensen on 04/30/07 09:04
On 29 Apr., 18:44, Erland Sommarskog <esq...@sommarskog.se> wrote:
> B D Jensen (bjorn.d.jen...@gmail.com) writes:
>
> > I didn't understand the last part about "ditch" (what means that?).
>
> To ditch = slänga, kasta, göra sig av med.
>
> > Will the use of functions make the select into very slow?
>
> Slower. I cannot say how much slower, but I would never use functions for
> this situation. Since this appears to be a one-off, code maintainability
> does not seem to be important.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
I made a comparison for the case of converting to tinyint
and wrote a loop going from -1mio to +1mio
using TSQL-function: 72 seconds
using directly between (not in a function): 70 seconds ; it's in
between ;^)
using directly <= and >= : 67seconds
(and CLR-function: 2min 27seconds)
So you are right not writing it in seperate function is faster (in
this case),
so it depends (... ;^) on the situation if the difference is too
costly.
Maybe it's one time only, but if you think you can reuse it, then at
all there is less typing and more
important: your code is much more readable, because it becomes shorter
and much more
natural too read. And if one finds an better implementation, you can
just replace it without affecting depending code.
Again: it depends ;^)
Best regards
Bjørn
Navigation:
[Reply to this message]
|