Computed column UDF - Drop Alt Recr instead of Alter

Forum for users of SQL Compare schema synchronization utility

Computed column UDF - Drop Alt Recr instead of Alter

Postby Lxocram » Thu Mar 01, 2012 2:26 pm

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
*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)

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
Posts: 17
Joined: Thu Jun 07, 2007 1:44 pm
Location: Belgium, Ghent

Return to SQL Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests