Hi all,
In a SQL database I got storage information for each user, for each customer.
I need to write a stored procedure that sums the disc usage (MB) for the customers users. When I got the total sum of all users for a single customer (totalDiscUsage), I need to perform a calculation (simple example):
x = numberOfUsers * 200
y = (totalDiscUsage - x) / (10 * 5)
After that, I need to write y to the database, and do that for all customers.
My question is how I can do this the best way?
Maybe using a cursor to go through each customer, perform the sum and calculation, and write the result to the database? Would that be a good solution?
Thanks in advance. Help will be much appreciated!