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
 displaying the SP script using QA

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-21 : 16:20:52
Hi do u know what the shortcut or the code command to diplay an SP code in QA.
Instead of right clicking the SP in QA and clicking "Script object to New window as Create" is there a command or a shortcut that I can type using keyboard
Thank you

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-21 : 17:09:53
see here for VS and SSMS shortcuts:
http://weblogs.sqlteam.com/mladenp/archive/2006/06/16/10246.aspx

i don't know of such shortcut though.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-21 : 17:50:35
You can see the text of a stored procrdure using the sp_helptext stored procedure.

use Northwind

exec sp_helptext '[dbo].[CustOrderHist]'

Results:

Text
--------------------------------------------------------------------------------------------
CREATE PROCEDURE CustOrderHist @CustomerID nchar(5)
AS
SELECT ProductName, Total=SUM(Quantity)
FROM Products P, [Order Details] OD, Orders O, Customers C
WHERE C.CustomerID = @CustomerID
AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID
GROUP BY ProductName




CODO ERGO SUM
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-21 : 20:43:37
cool thanks a lot
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-22 : 21:57:05
You can view it in Information)_Schema.routines View as well. But not sure if it display entire text if it has more than 8000 characters

Select Routine_name, Routine_definition from Information_schema.routines
where routine_name='your procedure name'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-22 : 22:13:24
quote:
Originally posted by madhivanan

You can view it in Information_Schema.routines View as well. But not sure if it display entire text if it has more than 8000 characters
...


The Information_Schema.routines view only shows the first row from syscomments, so it will only show part of many procedures.



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -