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 |
|
mhg1063
Starting Member
27 Posts |
Posted - 2004-08-26 : 08:49:16
|
| Hello all,I'm reviewing some syntax I wrote when I first started writing sql. I created a view and had some logic which required a Case statement MSS 2000 sp 3exampleMAX( CASE WHEN (RIGHT(profile,3)) = 'sv3' THEN rate_change ELSE 0 END ) AS lr_change_sv3, MAX( CASE WHEN (RIGHT(profile,3)) = 'sv2' THEN rate_change ELSE 0 END ) AS lr_change_sv2, MAX( CASE WHEN (RIGHT(profile,3)) = 'sv1' THEN rate_change ELSE 0 END ) AS lr_change_sv1I was wondering if I'm better served creating a UDF to obtain the proper profile prefix. I have to use this logic quite a few times in the view. I was thinking a udf would perform better. Any opinions? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-08-26 : 08:55:31
|
| no -- UDF's won't help you here in my opinion, and would in fact make your code less efficient due to the overhead of calling a UDF for each row in the aggregate calcs.- Jeff |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-26 : 08:56:00
|
| hey Dr. Congratulations on 2.5k postGo with the flow & have fun! Else fight the flow :) |
 |
|
|
mhg1063
Starting Member
27 Posts |
Posted - 2004-08-26 : 14:22:13
|
| THANKS FOR THE INPUT |
 |
|
|
|
|
|