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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Converting vba to transact sql

Author  Topic 

gamaz
Posting Yak Master

104 Posts

Posted - 2008-06-09 : 18:23:13
Hi,
I need to convert the following vba code (front end) to a backend stored procedure. The front end code is as follows:
if ((dbo_PWOPayback!AnnualVolumePer1000) * (dbo_PWOPayback!FirstyearRevenuePerThousand) - (dbo_PWOPayback!AnnualVolumePer1000) * (dbo_PWOPayback!LowestMktPriceMSRP) * dboPWOPayback!factor)
+ dbo_PWOPricing!mSRPMarketPrice) = 0 Then
ROI = 0
ElseIf (dbo_PWO_Costing!TotalToolingCost) = 0 Then
ROI = 0
Else
ROI = ((dbo_PWOPayback!AnnualVolumePer1000) * (dbo_PWOPayback!FirstyearRevenuePerThousand) - (dbo_PWOPayback!AnnualVolumePer1000) * (dbo_PWOPayback!LowestMktPriceMSRP) * dboPWOPayback!factor)
+ dbo_PWOPricing!mSRPMarketPrice) - dbo_PWOCosting!TotalToolingCost)/dbo_PWOCosting!TotalToolingCosting

How does one use select case in the above situation to determine the value of ROI? Any suggestions will be of great help. Thanks.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-09 : 18:47:55

SELECT CASE WHEN condition1 then 'value1' WHEN condition2 then 'value2' else 'value3' END from your_table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -