Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    New York, NY

    Unanswered: altering a computed column?

    somehow I am not able to figure this out.

    How do I change a computed column using the ALTER TABLE ALTER COLUMN... command?

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    --  ptp  20080227  Demo of kludge to allow change in computed column
    IF Object_Id('dbo.t1627793', 'U') IS NOT NULL
       DROP TABLE t1627793
    CREATE TABLE t1627793 (
       a				INT
    ,  b				INT
    ,  c				AS a + b
    INSERT INTO t1627793 (a, b) VALUES (3, 5)
    SELECT * FROM t1627793
    ALTER TABLE t1627793
       DROP COLUMN c
    ALTER TABLE t1627793
       ADD c AS a * b
    SELECT * FROM t1627793
    You have to kludge this, the ALTER TABLE command explicitly forbids you to directly alter a computed column.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts