I want to update a scalar function in our database. This function is used for several calculated columns in a key table so I get a dependency error if I try to update it. I can explicitly remove the columns, update the function and re-add the columns but, without a lot of extra fannying about, that will change column orders and might have other unintended consequences. I wondered if there was a cleaner way of doing it?
migrated from stackoverflow.com Apr 14 '12 at 19:53
This may be more work but it should get (approximately) what you are after:
1 - Create a new table that has just your PK from the main table and the updated function.
2 - Drop your old column
3 - Rename your old table to something like
4 - Create a
This will potentially create some issues with