|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Difference between two UDF
I'm executing a simple select statement with two UDFs - allocated_hours and actual_hours. I also need to calculate the difference between the two UDF in a separate column. However, I would rather not have to execute each UDF a second time to get the delta between the two UDFs, unless the experts out there feel the overhead will be nominal.
Is there a different way besides the following: SELECT column1 as Col1, allocated_hours(column1) as [Allocated Hours], actual_hours(column1) as [Actual Hours], allocated_hours(column1) - actual_hours(column1) as [Delta] FROM blah Thanks in advance |
|
#2
|
||||
|
||||
|
of course there is
![]() Code:
SELECT Col1
, [Allocated Hours]
, [Actual Hours]
, [Allocated Hours] - [Actual Hours] AS [Delta]
FROM (
SELECT column1 AS Col1
, allocated_hours(column1) AS [Allocated Hours]
, actual_hours(column1) AS [Actual Hours]
FROM blah
) AS foo
|
|
#3
|
|||
|
|||
|
Thanks!
Awesome! I'll try it out as soon as I can.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Difference between two UDF |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|