Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select and set to variable
Message
De
07/03/2015 09:24:58
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
07/03/2015 08:30:07
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Web
Divers
Thread ID:
01616353
Message ID:
01616397
Vues:
35
>Dmitry,
>
>With all due respect, you're taking the wrong approach. Yes, you can do this with a do while or even with (ugh) records based solution.
>Best is to calculate on the fly as I showed you earlier.
>
>By having seperate records for purchases and seperate records for sales, you keep way better track of what is happening and is faster than what you're trying to do now and you can calculate the stock in a single SQL statement of 10 lines.

Almost 20 years ago, our apps were doing this kind of calculation on the fly, so every move out of stock had a freshly calculated price, and any change in the inputs (i.e. correction of a price or quantity in a previous purchase, return to stock, anything that happened) would cause recalculation of prices (sometimes with limitations, as in "can't touch a closed month"), no matter whether it was a FIFO, instant average, monthly average or whichever method. And that was FPD2.6, local network on coaxial cable (probably still 100 megabit), 386 workstations and 486 file server with whopping 8MB running W95 or DOS 6.22, blazingly fast. Nobody even noticed that it may have done the recalculation (including stock update by quantity, price, current value) for all 30 or 50 items that were on the document. And the transaction table had tens of thousands of records, probably hundreds of thousands by the end of the year.

I don't see the need for more speed.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform