Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find & Replace Question

Status
Not open for further replies.

Savil

Programmer
Apr 28, 2003
333
EU
Hi all
Does anybody know of a way of doing a find and replace in ALL stored procedures rather than opening each sp individually and editing that way?

Thanks
 
The below query gives you the list of storedprocedures and the text contained in it.
I am not sure if you will be able to update the syscomments table. I haven't tried it. I thought this could be of some help to start with.

select so.name, sc.text from syscomments sc inner join sysobjects so on sc.id = so.id
where so.xtype = 'P' and sc.text like '%TEXT SEARCHING FOR%'


Thanks,
Manjari.
 
Thanks for your reply Manjari I will give it a go

Savil
 
You could then take that list and script all those stored procedures into one script and then do the find and replace in QA.

I would not recommend trying to replace text in the system tables. If you have script you can see each replacement before accepting it. Could be there are some that you need to keep. For instance suppose you want to change the field name test to test1. If you search for like '%test%' you might also find the places where you have field mytest and it would be disastrous to change that one without knowing.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top