|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Periodical execution and global variables
Hi..I have table that has the following fields:
ID, S, M, T, W, Th, F, Sa, LW, LM, Tmp, Tot I think you can guess what the first 8 fields stand for. The others: LW - Last Week LM - Last Month Tmp - TempTotal Tot - Total What I want to achieve : 1) Once every week, I want to sum up the values for all days of week and store them in LW. And I want to store the sum of values for that month in the Tmp field. 2) Once every month, I want to update 'total' from 'tmp'. What do you think is the best way to do it. I am not so convinced with the way I designed the table. If the design is OK, how can we perform the the required task periodically, like once every week and every month. I have an idea of using some sort of global variables but I have no idea of how to store a global variable in SQL server. Thanks, SJ |
|
#2
|
||||
|
||||
|
I think you might want to look into DTS, which allows you to schedule jobs.
|
|
#3
|
||||
|
||||
|
the best way to design the table is not to have fields like S, M, T, W, Th, F, Sa, LW, LM, Tmp, or Tot
i'm sorry, that only leaves ID which you don't need either what you do need is some kind of date field, and a quantity field from those two fields alone, you should be able to extract wekkday numbers, weekly number, monthly numbers, etc. never store into the database totals that can be calculated |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Periodical execution and global variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|