Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF params, return values & data conversion
Message
De
19/04/2004 04:42:19
 
 
À
14/04/2004 11:45:28
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00891543
Message ID:
00896038
Vues:
17
Daniel,

I'm using the function to calculate some totals from other tables and storing the result in a calculated field.

Ideally this should probably be done by using an insert,update trigger, but I'm a bit of a novice here and can't figure out how to pass parameters to the trigger.

In reality it's a bit more complex, but this does illustrate what I'd like to do:
Example:
Table1 Key Reservation_No,CBLineId,AmountTotal 

Table2 Key Reservation_No, CBLineId, LineId, Amount
On insert and update in Table2 the AmountTotal of the corresponding record in Table1 should be updated with SUM(Amount) where Table1.Reservation_No = Table2.Reservation_No AND Tale1.CBLine = Table2.CBLine




>>Hi Sergey,
>>
>>Yes, well, it's a shame though.
>>
>>BTW, if one uses a function as a formula in a calculated field and then later for some reason has to change something (bugs maybe <g>), the thing won't recompile because of dependencies.
>>
>>Short of removing the formula, saving the table, editing the function and then putting the formula back in, which is kind of tedious, is there a way around this?
>>
>No, unfortunately not. It's a big pain but that's what we are stuck with.
>
>BTW what exactly are you trying to do with the UDF? If you always want a money value, you can CONVERT within the function. On the other hand, as Sergey pointed out you can't make it generic like you tried.
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform