Tuesday, March 24, 2009

TSQL : Modifying Computed Column

You can't! Sorry... (as of sql 2005, 2008)

Drop the column and add it again, like this >
USE Adventureworks
go
ALTER TABLE Person.Contact
DROP COLUMN [RSVersion] 
go

ALTER TABLE Person.Contact
ADD RSVersion  AS 
(CHECKSUM(ContactID
,NameStyle
,Title
,FirstName
,MiddleName
,LastName
,Suffix
,EmailAddress
,EmailPromotion
,Phone
,PasswordHash
,PasswordSalt) ) PERSISTED NOT NULL

go

Links :
CHECKSUM as a computed column
MSDN Forums

No comments: