Afficher un message
Vieux 25/03/2008, 13h27   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it possible to cascade table and field name changes to views

John Sheppard (nospam@spamspam.com) writes:
> I was wondering if anyone knew if it were possible to make sql server 2005
> cascade field name changes down into dependant views.
>
> For example if I have a table
> table1
> - id
> - title
>
> and a view
> view1
> select id from table1
>
> Can I somehow make it so that if I change table1.id to table1.myId the
> view will automatically update?


No. In fact if you have a view with SELECT * in, and add/drop/rename a
column in a table, you need to do sp_refreshview for the view definition
to change. (Using SELECT * view definitions is not considered best
practice, by the way.)


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
 
Page generated in 0,05270 seconds with 9 queries