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.
Author |
Topic |
ssunny
Posting Yak Master
133 Posts |
Posted - 2009-01-14 : 13:16:51
|
Hello Guys,I have a table like this:create table dbo.test(test_id int not null,a varchar (50),b varchar (50),c as dbo.fn_calculate (e),d varchar (50),e varchar (50))As you can see c is the derived field which uses function call dbo.fn_calculate (e).Now for some reason I need to modify dbo.fn_calculate function but i got this error.Cannot ALTER 'dbo.fn_calculate ' because it is being referenced by object 'test'How can I fix this this?Thanks for the help. |
|
ssunny
Posting Yak Master
133 Posts |
Posted - 2009-01-14 : 14:43:02
|
Nevermind fixed the problem. This is what I did:alter table testadd c_temp varchar (50)goupdate testset c_temp = cgoalter table testdrop column cgoalter function dbo.fn_calculate ............... goalter table testadd c as dbo.fn_calculate (e)goalter table testdrop column c_tempgoI don't know if this was the best approach or not!!Thanks. |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-01-14 : 15:09:44
|
you did the right thing. |
|
|
|
|
|