August 22, 2013 at 3:24 am
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/
August 22, 2013 at 3:40 am
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.
August 22, 2013 at 3:47 am
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/
August 22, 2013 at 7:56 am
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 22, 2013 at 8:55 am
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.
August 22, 2013 at 9:01 am
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 23, 2013 at 12:14 am
Thanks..
I wil donwlaod it and work on it 😛
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply