Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
GDB
Starting Member
4 Posts |
Posted - 2008-01-01 : 22:33:21
|
I have a location table with columns for [state tax rate], [local tax rate] and a bit column for each to indicate if it is active. From this I need to calculate a total tax percentage; i.e.(state tax rate * bit) +(local tax rate * bit). If I want to stay at the database with this I can identify three alternatives (I'm sure there are more):1. Calculated column2. Table Variable (or Temp. Table)3. ViewI'm interested in feedback as to which of these methods is more appropriate or if there is a better way I haven't identified.Thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-02 : 02:18:51
|
I think a sinpe trigger is the choice here, because when the value is once calculated it is stored and easily accessed.With SQL Server 2005, you might want to consider a PERSISTED COMPUTED column. E 12°55'05.25"N 56°04'39.16" |
 |
|
GDB
Starting Member
4 Posts |
Posted - 2008-01-02 : 08:44:23
|
Thanks. I haven't worked with persisted computed columns before. I'll do some research. |
 |
|
henrikop
Constraint Violating Yak Guru
280 Posts |
Posted - 2008-01-11 : 03:51:18
|
PERSISTED COMPUTED columns are cool! Thx for the hint, did not encounter this before! And very useable for this kind of thing!Henri~~~~There's no place like 127.0.0.1 |
 |
|
|
|
|