constructing varchar computed column , using bit fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    constructing varchar computed column , using bit fields

    Hi,
    Due to a certain circumstance i have to add a field to my table, which would be a varchar type. this varchar contructs istfel using 4 fields of type bit

    so if the table def goes as
    isA(bit), isB(bit), isC(bit), isD(bit), ABCD(varchar(4) )

    the value of the field ABCD should be constructued from the 4 bit fields
    if isA,isC is checked then ABCD should be AC
    if isA,isB,isD is checked then ABCD should be ABD
    is there a way i could achieve it using computed columns or would i have to make a trigger..(which i am also not sure on how to go about it)

    Sorry for the trouble, but i couldnt get my head around with starting it either !

    thankyou
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Hi,
    Updating on what i have done
    Created a trigger on insert,update
    and with a series of IF statements i contructed the varchar field based on if the bit fields were set to true.

    Comment

    Working...