Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Search for text in sprocs (in Azure)


Search for text in sprocs (in Azure)

Author
Message
DavidMcAfee
DavidMcAfee
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 19
In SQL 2000 & 2005, I would use the following to search for text in my stored procedures:

DECLARE @s varchar(255)
SET @S = 'YourSearchTextHere'
DECLARE @msg varchar(255) ,@ul varchar(255)
select @s='%' + @s + '%'
select o.name , Seq=colid
,'SPLine'=substring(text,patindex(@s,text)-5, 30)
from syscomments c , sysobjects o
where o.id=c.id
AND o.name LIKE 'STP%'--Added this line to filter for my sprocs
and patindex(@s,text) > 0
order by name
SELECT @msg='* Stored procedures containing string "' + @s + '=' +
convert(varchar(8),@@rowcount) + ' *'
SELECT @ul=replicate('*',datalength(@msg))
Print ' '
PRINT @ul
PRINT @msg
Print @ul

Is there an equivalent call I can use in SQL 2012 / Azure?

When I try to use it in Azure, I get the following error:

Msg 40512, Level 16, State 1, Line 7
Deprecated feature 'String literals as column aliases' is not supported in this version of SQL Server.

Line 7 being:
'SPLine'=substring(text,patindex(@s,text)-5, 30)

If I comment that line out (as well as the last comma in the line above) I get the following error:
Msg 208, Level 16, State 1, Line 5
Invalid object name 'syscomments'.


Any ideas?

Thanks,
D



Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16566 Visits: 17016
Check out SQL Search. It is 100% and written by RedGate, the sponsors of SSC. :-D

http://www.red-gate.com/products/sql-development/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)
DavidMcAfee
DavidMcAfee
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 19
Thanks for that link. I downloaded it and installed it.

I don't know if I am doing something wrong, but it doesn't seem to do anything when I type into the search box.



Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16566 Visits: 17016
DavidMcAfee (5/22/2013)
Thanks for that link. I downloaded it and installed it.

I don't know if I am doing something wrong, but it doesn't seem to do anything when I type into the search box.


Do you have the dropdowns set? Do you the little searching bar flicker when you enter a character in the search box?

I would assume it is compatible with Azure. I can't find anything that states one way or the other on their site.

_______________________________________________________________

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)
DavidMcAfee
DavidMcAfee
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 19
OK, it must be an Azure thing.

I couldn't get it to work with out 2000 server, but did connect to my local box 2012 SS.

It does work on my local box.

hmmm, how do I search for text in sprocs in Azure...



DavidMcAfee
DavidMcAfee
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 19
I guess this answers my question :/

http://stackoverflow.com/questions/10985596/full-text-search-on-sql-azure



Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8239 Visits: 14368
DavidMcAfee (5/22/2013)
I guess this answers my question :/

http://stackoverflow.com/questions/10985596/full-text-search-on-sql-azure

no, full text search is something completely different.

the problem is likely that you are still referring to the old sql 2000 system tables. e.g references to syscomments should be replaced with sys.sql_modules.

Mapping System Tables to System Views

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search