Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kick Start My Brain
Message
 
 
À
17/02/2011 12:45:23
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01500443
Message ID:
01500567
Vues:
38
>>>Is it easy to do this as a computed column?
>>
>>Yes, of course. Using CASE expression and DATEADD fnction.
>
>Hi Naomi,
>
>I'm struggling a bit with this. I hope you or someone else has the time to give me a hand.
>
>I think what I need to do is create a scalar-valued function that returns the date and then add in a computed column to the table which calls this function. Is that right?
>
>My C# code gets a list of premiums paid and what the Premium Mode was for the payment, then loops through the result table adding months to the starting date. Here is where I get stuck. I don't know how to loop through a table in T-SQL, or if there is a better way. Any hints or help you can provide would be greatly appreciated.

I see. You want to do something like Running Total, correct? If so, then leave the logic in C#

T-SQL has some ideas for running totals (like Jeff Moden quirky update), but it's not official solution and not supported. So, for these kind of problems T-SQL may not be a good choice.

Unless I misunderstood the problem.

Perhaps you can post your table structure, what exactly do you want to get in SQL forum, then it will be easier to provide a solution.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform