How add calculation field in existing table


I am having table with ages. need to categorize the age to 0-5 = Low, 6-10 = Medium, 10= High. and add this new calculation field in the existing field. How to add this? Please help


you need to write a update statement with case statement.

Update TableName
WHEN BETWEEN '6' AND '9' THEN 'Medium'
WHEN '10' THEN 'High'

  1. Add a column [NEWAGEDESC] to the table, and use @ppatel11282 code to set it. However, you then need to maintain this column, in sync with [AGE], for all future updates.

  2. Add a Calculated Column. Personally I hate these because in the past they have interfered with our ability to add VIEWs with INDEXES and other such side effects

  3. Create a VIEW with the calculated value, and use the VIEW instead of the TABLE when you need the calculated value.

Personally I would do #3 unless you actually want to REPLACE the existing AGE column with the NEWAGEDESC column, in whichc ase I would do #1 and then DROP the original AGE column.


I am able to create the calculation and add the new column but it shows null when export the table.
Any thing missing.

If you show the code that you used then folk here can make suggestions as to what might have gone wrong. Otherwise we are just guessing!

Thank a Lot team. At Last I am able to get the results.