Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I need to perform some mathematical operations in an application. i want suggestions that implementing at which part will be performance wise more productive.

Like i need get data from 4 tables in db. And after that on retrieved data, numeric, multiplications & divisions will take place.

My questions is implementing these calculations in a stored procedure, or in code behind in grid view row bound event. Which will have more performance?

Ex. calculation in db:
SELECT CAST(ROUND((
((CAST(25 as float)/ CAST(100 as float)) * CAST(87.25 AS FLOAT)) +
((CAST(25 as float)/ CAST(100 as float)) * CAST(68.04 AS FLOAT)) +
((CAST(25 as float)/ CAST(100 as float)) * CAST(70.37 AS FLOAT)) +
((CAST(25 as float)/ CAST(100 as float)) * CAST(72.00 AS FLOAT))
), 2) AS NUMERIC(8,2))


What if the db has lot more data. And i need to use while loop in db for the calculations. Is that okay for performance wise.
Posted
Updated 26-Sep-13 21:16pm
v2
Comments
Maciej Los 27-Sep-13 2:11am    
We need more details (sample data and expected output).

1 solution

stored procedures only will have better performance. its a precompiled code..
if you want to know the accurate results, pls check with profiler.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900