Results 1 to 2 of 2

Thread: Formula columns

  1. #1
    Join Date
    Feb 2004
    Posts
    8

    Unanswered: 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,

  2. #2
    Join Date
    Mar 2003
    Location
    Indiana, USA
    Posts
    100
    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

    Quote Originally Posted by JohnLewis
    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,

Posting Permissions

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