0

i have two table in sql serever with no relation 1-rate table 2-jewellry tabale rate table hold diffrent rate for example usd , gold , platinume and jewellry table use holds jewellry item , and total price of each item is calculated real time based on rate value from rate table .

price field in jewellry table is computed column and has its own business rule , but in end it should use a value in rate table to complete the rule , for example gold rate in rate table*weight(jewellry table)*tax(rate table ).

how can i achive this in sql server ? store procedure ? function ? i dont want to use any client side because i want to export table via wcf as odata .

2 Answers 2

1

You can achieve this by creating a user-defined function that does the calculation that you want.

The computed column can then be set using the UDF.

Sign up to request clarification or add additional context in comments.

Comments

1

You can just use columns are contained in current table. For your purposes you can use triggers on foreign table for total sum calculation. Or you can use views for aggregation total results.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.