Thursday, March 29, 2012

Formula columns

Can anyone tell me how to find out if a column is a 'formula' or computed column - and what the formula is?

sp_columns @.table_name = 'table' gives me most of the stuff I want but it doesn't show what the formula is for any formula columns...

Cheers in advance,Try below code: Code is AS-IS No Warrenty

SELECT col.name, cm.text
FROM syscolumns col
JOIN syscomments cm ON cm.id = col.id AND cm.number = col.colid
WHERE COLUMNPROPERTY ( col.id , col.name, 'IsComputed' ) = 1 AND OBJECT_NAME(col.id) = 'tablename'

Tim S

Can anyone tell me how to find out if a column is a 'formula' or computed column - and what the formula is?

sp_columns @.table_name = 'table' gives me most of the stuff I want but it doesn't show what the formula is for any formula columns...

Cheers in advance,

No comments:

Post a Comment