How To Modify a Normal Column to Computed Column

  • Hi,

    How do I modify a Normal column to a Computed Column? For example I have a table which already has a 3 columns a,b,c. Now I want to modify the c column to become a computed column with a simple expression c=a (the value of c column will always be the same as a's)

    What DDL SQL stmt should I run?

    Thanks for any help

    Hendry

     

     

  • UPDATE table SET c = c + a 



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • AJ Ahrens, That Sql stmt doesnt' modify the schema of the table. It only updates the table just when you run that stmt.  My Question is how to modify the schema of a table to allow an existing column to become a computed collumn.

    In the BOL there's a procedure to add computed column. For example: ALTER TABLE MyTable ADD MyComputedCol As ....

    However, I couldn't find a DDL stmt to modify a normal column to a computed one.

    Any ideas?

    Thanks

    Hendry

     

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply