Red Gate forums :: View topic - Computed column UDF - Drop Alt Recr instead of Alter
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Computed column UDF - Drop Alt Recr instead of Alter

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
Lxocram



Joined: 07 Jun 2007
Posts: 16
Location: Belgium, Ghent

PostPosted: Thu Mar 01, 2012 3:26 pm    Post subject: Computed column UDF - Drop Alt Recr instead of Alter Reply with quote

When a table has a computed column that references a UDF and the definition of the UDF changes the computed column should be dropped and re-added
so->
*select computed columns that reference the UDF
*drop these columns
*alter the function
*readd computed columns

Otherwise the synchronization script throws errors like

cannot ALTER 'dbo.get_Username_Personeelslid_COMPUTED_COLUMN' because it is being referenced by object 'sec_Dossiergebruikers'.

This of course should be an option (drop and recreate computed columns) just like the assembly option (do not use alter assembly)

TIP:
I tend to use 2 functions
*'dbo.get_Username_Personeelslid_COMPUTED_COLUMN' is the one being referenced by computed columns
It calls upon a second function

'dbo.get_Username_Personeelslid' with the same parameters

That way you can work around the "referenced by" safety and update your function definition
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group