Wednesday, February 15, 2012

Editing views in 2005 Management Studio

It was always the custom in Enterprise Manager, when creating a view, to
create a dummy view, e.g.:
SELECT 1
save it, then go back and edit the view. This way, you could edit the view
definition without Enterprise Manager destroying your formatting, and you
can add comments.
Now using "Microsoft SQL Server Management Studio", there is no longer a
"Properties" option if i right-click a view name.
So where is the option to edit a vew in MS?
(Is "MS" what we're abbreviating "Management Studio" these days?)Right click the view name in Management Studio and select Modify from
the context sensitive pop-up menu. Personally I always write creation &
alter scripts for every DDL object I create - that way you don't have
some GUI changing all your formatting etc. (also it's good for getting
the DDL syntax in your head).
I think Management Studio is commonly abbreviated SSMS (SQL Server
Management Studio). It seems to be the way Microsoft have marketed the
SQL 2005 products:
SSMS - SQL Server Management Studio
SSAS - SQL Server Analysis Service
SSIS - SQL Server Integration Services
SSRS - SQL Server Reporting Services (although I've often seen this as
just RS)
etc.
Although now that I think about it I've never seen Service Broker
abbreviated and I've seen Reporting & Notification Services abbreviated
as RS & NS (in fact I can't remember ever seeing Notification Services
abbreviated SSNS). Hmmm...
*mike hodgson*
http://sqlnerd.blogspot.com
Ian Boyd wrote:

>It was always the custom in Enterprise Manager, when creating a view, to
>create a dummy view, e.g.:
> SELECT 1
>save it, then go back and edit the view. This way, you could edit the view
>definition without Enterprise Manager destroying your formatting, and you
>can add comments.
>Now using "Microsoft SQL Server Management Studio", there is no longer a
>"Properties" option if i right-click a view name.
>
>So where is the option to edit a vew in MS?
>(Is "MS" what we're abbreviating "Management Studio" these days?)
>
>|||Do you mean using the query building tool? If you just want to edit in
text, click on Script View, Create As, To New Query Window and edit it
there. I tend to do that with all objects in SSMS
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Ian Boyd" <admin@.SWIFTPA.NET> wrote in message
news:OWljNm4KGHA.3984@.TK2MSFTNGP14.phx.gbl...
> It was always the custom in Enterprise Manager, when creating a view, to
> create a dummy view, e.g.:
> SELECT 1
> save it, then go back and edit the view. This way, you could edit the view
> definition without Enterprise Manager destroying your formatting, and you
> can add comments.
> Now using "Microsoft SQL Server Management Studio", there is no longer a
> "Properties" option if i right-click a view name.
>
> So where is the option to edit a vew in MS?
> (Is "MS" what we're abbreviating "Management Studio" these days?)
>|||Not completely. BIDS is Business Intelligence Studio (though it could be
SSBIDS :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23f$o554KGHA.1312@.TK2MSFTNGP09.phx.gbl...
Right click the view name in Management Studio and select Modify from the
context sensitive pop-up menu. Personally I always write creation & alter
scripts for every DDL object I create - that way you don't have some GUI
changing all your formatting etc. (also it's good for getting the DDL syntax
in your head).
I think Management Studio is commonly abbreviated SSMS (SQL Server
Management Studio). It seems to be the way Microsoft have marketed the SQL
2005 products:
SSMS - SQL Server Management Studio
SSAS - SQL Server Analysis Service
SSIS - SQL Server Integration Services
SSRS - SQL Server Reporting Services (although I've often seen this as just
RS)
etc.
Although now that I think about it I've never seen Service Broker
abbreviated and I've seen Reporting & Notification Services abbreviated as
RS & NS (in fact I can't remember ever seeing Notification Services
abbreviated SSNS). Hmmm...
mike hodgson
http://sqlnerd.blogspot.com
Ian Boyd wrote:
It was always the custom in Enterprise Manager, when creating a view, to
create a dummy view, e.g.:
SELECT 1
save it, then go back and edit the view. This way, you could edit the view
definition without Enterprise Manager destroying your formatting, and you
can add comments.
Now using "Microsoft SQL Server Management Studio", there is no longer a
"Properties" option if i right-click a view name.
So where is the option to edit a vew in MS?
(Is "MS" what we're abbreviating "Management Studio" these days?)|||"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23f$o554KGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Right click the view name in Management Studio and select Modify from
> the context sensitive pop-up menu. Personally I always write creation &
> alter scripts for every DDL object I create - that way you don't have
> some GUI changing all your formatting etc. (also it's good for getting
> the DDL syntax in your head).
That doesn't work. It shows me the SQL of the view, but not the view
defintion itself. And if i modify the SQL formatting, or add comments, the
formatting is destroyed and comments are removed.
Any other suggestions?|||> Do you mean using the query building tool? If you just want to edit in
> text, click on Script View, Create As, To New Query Window and edit it
> there. I tend to do that with all objects in SSMS
i want the equivalent of Enterprise Manager's
Right-Click->Properties
i don't want to have to script the view, and then run a drop-create.
Everyone, it's okay to admit that it cannot be done in SSMS.|||> Everyone, it's okay to admit that it cannot be done in SSMS.
Sorry, just trying to figure out what you want and fit an answer to your
request.
If you are asking is the paradigm of SSMS the same as EM. No, not at all.
(And I don't like query editors at all, so I would never have used it in EM
either.) SSMS uses an editing paradigm of files, and you start one by
scripting objects to the file.
Instead of scripting it as CREATE, script is as ALTER and you can save
changes by just executing the batch.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Ian Boyd" <ian.msnews010@.avatopia.com> wrote in message
news:eWlEZi$KGHA.1236@.TK2MSFTNGP10.phx.gbl...
> i want the equivalent of Enterprise Manager's
> Right-Click->Properties
> i don't want to have to script the view, and then run a drop-create.
> Everyone, it's okay to admit that it cannot be done in SSMS.
>|||"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
news:ellSfRALGHA.2780@.tk2msftngp13.phx.gbl...
> If you are asking is the paradigm of SSMS the same as EM. No, not at all.
> (And I don't like query editors at all, so I would never have used it in
> EM either.)
i also don't like query editors, and always created and edited view DDL
directly

> Sorry, just trying to figure out what you want and fit an answer to your
> request.
...which was different from Right-Click->Design View|||Yeah, OK. Looks like the Modify menu option is about as close as SSMS
gets to the old SQLEM view properties. But you're right - it reformats
stuff (don't you hate it when tools do that!).
The easiest thing for you to do (doesn't require hand-crafting scripts)
is to just right click the view name and select Script View As | ALTER
To | New Query Editor Window. That will automatically generate the
ALTER VIEW script for you from the actual view schema (ie. it'll keep
whatever comments & whitespace were in the code). All you have to do is
change the bits you want changed and then execute the ALTER VIEW
statement. You don't even have to save the script if you don't want
(although, personally, I would always keep a record of what I changed in
the DDL). And since it's an ALTER statement it'll keep dependencies,
permissions & all those other things that tend to disappear and get
forgotten when you DROP VIEW... CREATE VIEW...
That's about as close as I can suggest to simulate the old View
Properties dialog box in SQLEM.
*mike hodgson*
http://sqlnerd.blogspot.com
Ian Boyd wrote:

>"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
>news:ellSfRALGHA.2780@.tk2msftngp13.phx.gbl...
>
>i also don't like query editors, and always created and edited view DDL
>directly
>
>
>
>
>...which was different from Right-Click->Design View
>
>|||use Script as Alter.
EM scripts the view to the properties window using a CREATE, so it ran a
drop-create under the hood, and restored permissions.
The only thing the properties window gave you that scripting doesn't is
the permissions button.
But if you script as alter instead, you don't have to worry about losing
permissions, so that's moot.
The advantages of having the script (you can search, it's not a modal
window, it's far easier to read, you can save to a file directly from
it, etc.) far outweight the EM properties window. [i rap knuckles around
here when i see people using EM props window :)]
Ian Boyd wrote:
>
> i want the equivalent of Enterprise Manager's
> Right-Click->Properties
> i don't want to have to script the view, and then run a drop-create.
> Everyone, it's okay to admit that it cannot be done in SSMS.
>

No comments:

Post a Comment