PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Is it possible to cascade table and field name changes to views
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Is it possible to cascade table and field name changes to views

Réponse
 
LinkBack Outils de la discussion
Vieux 25/03/2008, 10h09   #1
John Sheppard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Is it possible to cascade table and field name changes to views

Hello there,

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?

Kinda just the same way MS-Access does it. That'd be neat.

Thank you kindly for any ideas
John Sheppard


  Réponse avec citation
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
Vieux 25/03/2008, 14h20   #3
John Sheppard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it possible to cascade table and field name changes to views


"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns9A6C807F8CFC8Yazorman@127.0.0.1...
> 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


hmm doh.....thanks Erland....I'd imagine this would lead to some very messy
databases over time...I'll have to make sure i get it right first go..

btw if you recall my last saga I found out I can make ssms save change
scripts to a file which is working ok i think.

  Réponse avec citation
Vieux 26/03/2008, 00h24   #4
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:
> btw if you recall my last saga I found out I can make ssms save change
> scripts to a file which is working ok i think.


Scrutinize those change scripts very closely. That's a very buggy part
of SSMS.


--
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
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h08.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11218 seconds with 12 queries