Thursday, March 22, 2012

computed column formula

Is it possible to retrieve the formula associated with a computed column using t-SQL? I can use COLUMNPROPERTY( id, column, 'IsComputed') to find the computed columns, but how do I get the formula itself?

Thanks,

Mable

sp_helptext 'TableName', 'Computed Column Name'

For eg


CREATE TABLE T(i int, j AS i *2)

INSERT INTO T(i) VALUES(10)
SELECT * FROM T

sp_helptext 'T', 'j'

|||

Thank you! That is just what I needed.

--Mable

No comments:

Post a Comment