Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored procs script

Author  Topic 

JHA
Starting Member

3 Posts

Posted - 2008-01-27 : 16:16:17
Can someone please point me in the right direction (guidance or url to a utility or article) as to how we can write a script to scan all of the stored procedures in our database for any reference to a field name were are about to change? Also, can we use such a script to do the actual change from the old field name to the new one?

Thanks!

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-27 : 16:56:04
Look at text column in sys.syscomments view.
Go to Top of Page

CShaw
Yak Posting Veteran

65 Posts

Posted - 2008-01-27 : 21:58:27
Select o.name from syscomments c
Join sysobjects o
On c.id = o.id
Where text like '%yourcolumn%'

I would not update the syscomments table to change the name in there.

Chris Shaw
www.SQLonCall.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-28 : 00:52:42
Sciptout
Search
Modify
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/12/13/script-out-procedures-and-functions-part-2.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -