Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Edit view in SSMS

Author  Topic 

Magua
Starting Member

2 Posts

Posted - 2014-05-22 : 05:46:36
I have several views in a database that I need to edit in SSMS 2008.
If I right click on a view, I can select "Design" and do the changes and save. Everything saves ok.
However, I cannot enter comments that way. I have tried View Script As -> ALTER To -> New Query Editor Window but this method creates a new view e.g. SQLQuery1 i.e. I can't save the origial view name.
Is there a way to alter views in code and save them back into the database under thier original view name?
TIA
Alan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-05-22 : 07:03:19
The name of the view (you can see the name in the "Alter View Viewname ..." has nothing to do with the name of the script that you will save to disk as a file.

Viewname will be the name in the database.

The changs will be made by running the script and not when saving the script.


Too old to Rock'n'Roll too young to die.
Go to Top of Page

Magua
Starting Member

2 Posts

Posted - 2014-05-22 : 08:59:59
Yes, that works.
Thanks
Alan
Go to Top of Page

GouravSaxena1987
Starting Member

23 Posts

Posted - 2014-05-22 : 13:58:41
Alter View ViewName is the simplest way to do this

Regards,
Gourav Saxena
Data Warehouse Counsultant
GouravSaxena1987@gmail.com
Go to Top of Page
   

- Advertisement -