Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Search Value Expand / Collapse
Author
Message
Posted Thursday, August 22, 2013 3:24 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 11:50 PM
Points: 1,867, Visits: 2,275
Hi,

I want to search a word in all stored procedure and create the list of stored procedures where that word exists. I am done with that but one more scenario added to that is that only search those stored procedure where that word is present in an uncommented lines only (exclude those stored procedures where that word present in commented lines).

Is this possible?



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1487130
Posted Thursday, August 22, 2013 3:40 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 2:00 AM
Points: 2,078, Visits: 2,409
I think that is a going to be very complicated. When the line is commented using "--" you are able to match it with "AND NOT LIKE '%--%' ". But when the line is commented using the "/*...*/" block, the comment string doesn't have to be in the same line as the search string.
You probably have to build logic to
first: get the complete text
second: remove all commented text (both between /* ... */ and between -- ... line-end)
finally: search for the searchstring in the remaining text.


** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1487141
Posted Thursday, August 22, 2013 3:47 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 11:50 PM
Points: 1,867, Visits: 2,275
Yes, its a bit complicated thing....
I have around 1k procedures and if follow thats steps its going to be like a summer vacation home work



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1487145
Posted Thursday, August 22, 2013 7:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:05 PM
Points: 11,927, Visits: 10,967
Doing that with t-sql is likely to only be close at best. Have you tried using SQL Search?

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1487272
Posted Thursday, August 22, 2013 8:55 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, April 08, 2014 6:47 AM
Points: 69, Visits: 557
Yes, use SQL Search (it's free I think) as you're just rewriting that functionality really

EDIT: Even SQL Search doesn't check whether the searc string is commented or not.
Post #1487323
Posted Thursday, August 22, 2013 9:01 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:05 PM
Points: 11,927, Visits: 10,967
SQL Search is free and it is from our sponsors RedGate.

It is an invaluable tool that belongs in everyones tool box.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1487333
Posted Friday, August 23, 2013 12:14 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 11:50 PM
Points: 1,867, Visits: 2,275
Thanks..
I wil donwlaod it and work on it



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1487646
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse