C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






How to write a stored procedure to search


Posted Date: 04 May 2008    Resource Type: Code Snippets    Category: SQL
Author: http://dotnetvj.blogspot.comMember Level: Diamond    
Rating: Points: 10



The following code sample can be used in a stored procedure to search
select so.name as 'storProc'
from sysobjects so
join syscomments sc
on so.id=sc.id
where so.type='P'
and sc.[text] like '%String you want to find%'




Responses

Author: Anand Keshav    05 May 2008Member Level: Bronze   Points : 2
From above code things are not clear.it should be in proper manner.




Author: andy robarts    05 May 2008Member Level: Gold   Points : 2
USE MASTER
GO
CREATE PROCEDURE [dbo].[sp_LockDetail]
AS

BEGIN
SELECT

SessionID = s.Session_id,
resource_type,
DatabaseName = DB_NAME(resource_database_id),
request_mode,
request_type,
login_time,
host_name,
program_name,
client_interface_name,
login_name,
nt_domain,
nt_user_name,
s.status,
last_request_start_time,
last_request_end_time,
s.logical_reads,
s.reads,
request_status,
request_owner_type,
objectid,
dbid,
a.number,
a.encrypted ,
a.blocking_session_id,
a.text
FROM
sys.dm_tran_locks l
JOIN sys.dm_exec_sessions s ON l.request_session_id = s.session_id
LEFT JOIN
(
SELECT *
FROM sys.dm_exec_requests r
CROSS APPLY
sys.dm_exec_sql_text(sql_handle)
) a ON s.session_id = a.session_id
WHERE
s.session_id > 50
EN





Author: venkat kamal    05 May 2008Member Level: Gold   Points : 2
hey its not clear, so give clear information.........


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to check whether a Column exists in table if not then add it to the table
Previous Resource: How to Check for Duplicate Records in SQL Server
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use