| Author |
Topic |
|
AurasD
Starting Member
23 Posts |
Posted - 2009-01-12 : 10:19:03
|
| Hello!I have a problem with 2 computed columns when I insert a new row.The database saves the data but says that it can't retrieve it so I get an icon error and the computed columns fields are filled with null and null is written as read only.I guess the database try's to calculate the columns in the same time so that is why the concurrency occurs.So how do I escape this error? Thank you |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 10:23:49
|
| what have you given as definitions of computed columns? |
 |
|
|
AurasD
Starting Member
23 Posts |
Posted - 2009-01-12 : 11:32:17
|
well one i have a table with 4 columns:PersID,PersLoccation ,PersLocCode and BulNr.Now this PersLocCode is dependent of PersLocation.For example if PersLocation is Dambovita the PersLocCode is DB,if it's Arges the PersLocCode is AG.So it's computed column formula is:(case [PersLocation] when 'Dambovita' then 'DB' when 'Arges' then 'AG' end) The oher column is meant to reproduce the PersID which is an autonumber.So it's formula is :([PersID]) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 11:40:07
|
quote: Originally posted by AurasD well one i have a table with 4 columns:PersID,PersLoccation ,PersLocCode and BulNr.Now this PersLocCode is dependent of PersLocation.For example if PersLocation is Dambovita the PersLocCode is DB,if it's Arges the PersLocCode is AG.So it's computed column formula is:(case [PersLocation] when 'Dambovita' then 'DB' when 'Arges' then 'AG' end) The oher column is meant to reproduce the PersID which is an autonumber.So it's formula is :([PersID])
this is not a good approach.For getting codes for location you should be keeping a separate mapping table with fields (LocCode,Location), which you need to join onto this table in queries to get corresponding codes.For getting autonumber, no need of computed column, just make column an identity column. |
 |
|
|
AurasD
Starting Member
23 Posts |
Posted - 2009-01-12 : 12:50:50
|
| I will think what you said,but still this means that you can't have a 2 computed columns in the same table because of this concurrency error? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 12:54:51
|
quote: Originally posted by AurasD I will think what you said,but still this means that you can't have a 2 computed columns in the same table because of this concurrency error?
you can two or three computed columns, but you cant have computed column that maps onto itself like PersID in your case. |
 |
|
|
AurasD
Starting Member
23 Posts |
Posted - 2009-01-12 : 13:16:32
|
| So let's see if I understood this well:I shouldn't use autonumber columns as an expression of a computed columns.But tell me,in my table if the PersID(which is the ID of a person ) has the same values like the BulNo how can I make?I mean PersID is a FK .I mean how to name the new column,and it's not wrong to use a column for many purposes?Oh and thank you for your advices ,I'm new to this. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 23:58:56
|
| what i told was you cant set computed column to itself. you can very well set it to point to another autonumber. I cant understand reason for this though. |
 |
|
|
|