May 22, 2013 at 12:38 pm
In SQL 2000 & 2005, I would use the following to search for text in my stored procedures:
DECLARE @s-2 varchar(255)
SET @s-2 = 'YourSearchTextHere'
DECLARE @msg varchar(255) ,@ul varchar(255)
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-2 + '=' +
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
May 22, 2013 at 12:49 pm
Check out SQL Search. It is 100% and written by RedGate, the sponsors of SSC. 😀
http://www.red-gate.com/products/sql-development/sql-search/[/url]
_______________________________________________________________
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/
May 22, 2013 at 2:24 pm
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.
May 22, 2013 at 2:30 pm
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 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/
May 22, 2013 at 2:48 pm
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...
May 22, 2013 at 2:53 pm
I guess this answers my question :/
http://stackoverflow.com/questions/10985596/full-text-search-on-sql-azure
May 24, 2013 at 8:03 pm
DavidMcAfee (5/22/2013)
http://stackoverflow.com/questions/10985596/full-text-search-on-sql-azure%5B/quote%5D
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
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply