Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using calculated fields in calculation

Status
Not open for further replies.

grnzbra

Programmer
Joined
Mar 12, 2002
Messages
1,273
Location
US
I have several complex (the sql statement for it runs about 5 pages when copied to Word) Access make table queries which have the following calculated field:

COMPANYDOLLAR: [Gross_Commission_Amount]-([Amount_Paid_to_Other_Broker]+[Total_Listing_Referral_Payouts]+[Total_OTT_Referral_Payouts]+[Total_Selling_Referral_Payouts]+[CoExclusiveAgencyFees]+[TotalSellReportingGrossComm]+[TotalListReportingGrossComm])

The value COMPANYDOLLAR appears the calculations of a number of other calculated fields. I need to convert this query into a stored procedure, but can't use COMPANYDOLLAR in the other calculated fields of the SP. I tried using a view to calculate COMPANYDOLLAR with the idea of basing the the SP on the view and then using COMPANYDOLLAR for the SP calculations, but that didn't seem to work.

This if a very complex query (on of a series of complex action queries that create and load a table) so replacing COMPANYDOLLAR with its calculation in every place that it appears becomes prohibitive. I've thought of a user defined function (I'm using SQL Server 2000) but I would still have to show the parameters being fed in at each location of the function.

How do you deal with this kind of problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top