If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > finding text within a stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-02, 18:37
yalnik yalnik is offline
Registered User
 
Join Date: Nov 2002
Posts: 11
Question finding text within a stored procedure

how can i search for text within stored procedures in SQL Server. I am used to working with Oracle and am unsure how SQL Server handles this.

So far i have found a system table - SYSCOMMENTS - that appears to hold the text of the stored procedures but this is compressed and therefore my search is not working.

My goal is to search all stored procedures (about 100) to see which ones use certain tables.

Cheers
stu
Reply With Quote
  #2 (permalink)  
Old 12-03-02, 23:59
DBA DBA is offline
Registered User
 
Join Date: Oct 2002
Posts: 369
Re: finding text within a stored procedure

Syscomments contains stored procedure text in the text column. Longer procedures and encrypted ones will require additional effort.
Reply With Quote
  #3 (permalink)  
Old 12-05-02, 18:07
yalnik yalnik is offline
Registered User
 
Join Date: Nov 2002
Posts: 11
Re: finding text within a stored procedure

Quote:
Originally posted by DBA
Syscomments contains stored procedure text in the text column. Longer procedures and encrypted ones will require additional effort.
thanks DBA, but as you can see from above I had already found this table. Duie to the fact that the stored procedures are compressed i can only see the first 300 or so characters.

Any other help?
Reply With Quote
  #4 (permalink)  
Old 12-06-02, 02:55
DBA DBA is offline
Registered User
 
Join Date: Oct 2002
Posts: 369
Post Re: finding text within a stored procedure

RE:
Quote:

thanks DBA, but as you can see from above I had already found this table. Duie to the fact that the stored procedures are compressed i can only see the first 300 or so characters.
Q1 Any other help?
A1 Sure, start with sp_helptext (for functionality you need to use directly and / or incorporate).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On