Steps to alter function used as computed column

What is the best way to change a function that is currently being referenced from a calculated column in a table? I get the following error when I try to alter it.

Msg 3729, Level 16, State 3, Procedure fn_sdtAcctJoin2, Line 232

Cannot ALTER 'dbo.fn_sdtAcctJoin2' because it is being referenced by object 'tblMembers'.

[365 byte] By [st8floorsup] at [2008-1-2]
# 1

1. Remove the computed column using


ALTER TABLE MyTable
DROP COLUMN MyComputedColumn

2. Correct the FUNCTION

3. Recreate the computed column using:


ALTER TABLE MyTable
ADD COLUMN MyComputedColumn = NewDefinition

ArnieRowland at 2007-9-13 > top of Msdn Tech,SQL Server,Transact-SQL...
# 2
I was hoping there was a better way of doing this. Thanks for you help.
st8floorsup at 2007-9-13 > top of Msdn Tech,SQL Server,Transact-SQL...

SQL Server

Site Classified