Powered by Blogger.

Saturday, February 15, 2014

Get stored procedure source text in sql server 2008

In this post we will discuss how to get stored procedure text in sql server 2008. Also you can check out my previous posts on:

- Working with enterprise library for data access in asp.net Part-2

- ModalPopupExtender example in Ajax in Asp.Net

- Filter Attribute in MVC

Recently I got a situation where I do not have permission to create or modify stored procedure, so I can not right click and click on modify to see the content of the stored procedure. But I need to check the stored procedure content. So I was looking for a query to get the content.

Below is the query:

SELECT object_definition(object_id('Stored Proccedure Name')) AS [Object Definition];

SELECT object_definition(object_id('UserMaster_select')) AS StoredProcedureDetails

This Select statement will return the stored procedure as a Text.

The result will come like below: