Home All Groups Group Topic Archive Search About

viewing procedure code in management studio

Author
2 Nov 2005 6:03 AM
Quinn
How do you view stored procedure code in management studio without scripting
it out or selecting modify?

Author
2 Nov 2005 8:38 AM
Michael Cheng [MSFT]
Hi Quinn,

Thanks so much for your kindly separate the questions.

If you want to view the code of stored procedures in SQL Server Management
Studio, you could execute sp_helptext to see the context.

For example: check the code dbo.uspGetBillOfMaterials under AdventureWorks

use AdventureWorks
GO
sp_helptext 'dbo.uspGetBillOfMaterials'
GO

Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others: https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page: http://support.microsoft.com/common/international.aspx
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
2 Nov 2005 12:30 PM
Jasper Smith
As well as sp_helptext you can also use the object_definition function or
the sys.sql_modules catalog view e.g.

sp_helptext 'dbo.uspGetBillOfMaterials'
select definition from sys.sql_modules
where [object_id] = object_id('dbo.uspGetBillOfMaterials')

select object_definition(object_id('dbo.uspGetBillOfMaterials'))

--
HTH

Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org

Show quote
"Quinn" <dellsql@newsgroups.nospam> wrote in message
news:ezHMdM33FHA.3160@TK2MSFTNGP10.phx.gbl...
> How do you view stored procedure code in management studio without
> scripting it out or selecting modify?
>
Author
3 Nov 2005 1:44 AM
Quinn
Thank you for the responses Jasper and Michael. I'm aware of all these
approaches. I guess I should have been more clear and have asked if there
was a way to view the code by double clicking on the stored procedure like
we can currently in EM.


Show quote
"Jasper Smith" <jasper_smi***@hotmail.com> wrote in message
news:eyIjuk63FHA.3976@TK2MSFTNGP15.phx.gbl...
> As well as sp_helptext you can also use the object_definition function or
> the sys.sql_modules catalog view e.g.
>
> sp_helptext 'dbo.uspGetBillOfMaterials'
> select definition from sys.sql_modules
> where [object_id] = object_id('dbo.uspGetBillOfMaterials')
>
> select object_definition(object_id('dbo.uspGetBillOfMaterials'))
>
> --
> HTH
>
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
>
> "Quinn" <dellsql@newsgroups.nospam> wrote in message
> news:ezHMdM33FHA.3160@TK2MSFTNGP10.phx.gbl...
>> How do you view stored procedure code in management studio without
>> scripting it out or selecting modify?
>>
>
>
Author
3 Nov 2005 7:37 AM
Michael Cheng [MSFT]
Hi Quinn,

Thanks for your reply.

I understood you would like to double-click the name of stored procedure
and then view the code. For SQL Server 2005, the most convenience way to do
so is: right click the stored procedure name, select Modify.


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

AddThis Social Bookmark Button