Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Computed Column

Author  Topic 

chriztoph
Posting Yak Master

184 Posts

Posted - 2012-04-22 : 21:41:07
Hi,

Need help here.

here is my code for my computed column,
my computed column is DepositedDate.

is this valid?

CASE WHEN DepositedDate = '1900-01-01' THEN CASE WHEN StatusID = 30 THEN CONVERT(DATE, CURRENT_TIMESTAMP) ELSE DepositedDate END ELSE DepositedDate END

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-22 : 21:50:21
you cant create a computed column based on expression using same column. you need to either create this as a new column or implement this logic inside a trigger

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -