Solved

best system table to search code

Posted on 2011-03-08
9
262 Views
Last Modified: 2012-05-11
what is the best system table in 2000 and 2005+ to search for specific text in a code (UDF or proc) etc

thanks
0
Comment
Question by:anushahanna
  • 3
  • 3
  • 3
9 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 250 total points
ID: 35073404

SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35073616
OK-

I guess in 2000, that is the only option, right?

what about in 2005 & 2008?
0
 
LVL 39

Assisted Solution

by:lcohan
lcohan earned 250 total points
ID: 35073665
Always and all versions I use:

usemydb
go
select * from sys.syscomments where text like '%something%'
go

this will return ALL unencrypted SQL code objects containing "something"
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35073716
good point - INFORMATION_SCHEMA.ROUTINES also will work on all versions, right?
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 32

Expert Comment

by:ewangoya
ID: 35073729
correct, INFORMATION_SCHEMA.ROUTINES for all versions
0
 
LVL 39

Expert Comment

by:lcohan
ID: 35073845
"Returns the first 4000 characters of the definition text of the function or stored procedure if the function or stored procedure is not encrypted. Otherwise, returns NULL."

http://msdn.microsoft.com/en-us/library/ms188757%28SQL.90%29.aspx

Where do you get the Views and Triggers code from?
As far as I'm aware they are ALL in sys.syscomments.text column

0
 
LVL 32

Expert Comment

by:ewangoya
ID: 35074066

@icohan
What are you talking about?

This question is about UDFs and Stored Procedures
0
 
LVL 39

Expert Comment

by:lcohan
ID: 35074170
Right - my bad...overlooked that and thought is ALL sql code objects.
Please disregard my answer.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35077209
thanks to both of you!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now