Saturday, July 28, 2012

How to get Computed column definition ?

It is easy..using sp_Helptext system stored procedure we can get computed column definition .

Create Table ComputedColumn
(
AmountA INT,
AmountB INT,
AmountC AS (ISNULL(AmountA,0) + IsNull(AmountB,0))
)

INSERT INTO ComputedColumn
SELECT 1, 2

SELECT * FROM ComputedColumn

sp_Helptext ComputedColumn , AmountC 
 
OUTPUT
----------
(isnull([AmountA],(0))+isnull([AmountB],(0)))
 

No comments: