If we want to change the name MyColumnNameto MyAlteredColumnName...
... and we have a SQL Server 2008 table that looks like this:
MyTable
MyColumnName
and a view that refers to the following column:
CREATE VIEW MyDependentView WITH SCHEMABINDING
AS
SELECT ..., MyTable.MyColumnName
As a result, we perform the following procedure:
- Delete view
- Changing the name MyTable.MyColumnName to MyTable.MyAlteredColumnName
- Recreating the view with reference to the name MyAlteredColumnName
We do this with a network-mitrator.
Is there a better way to do this? Is there T-SQL that will change the view column name? Or any support in SQL Server 2008 for automatically linking columns together?
source
share