Friday, February 24, 2012

Global Stored Proc Find and Replace

Hello all,
Being a relative newbie to large scale MSSQL development, I'd like to try and find out if there is some sort of utility, command or stored proc that I can use to globally change all text within my database's stored procedures.

For example... I would like to change a table name from dbo.xtable... to dbo.ytable... Is this possible?

Actually, I'd be happy with some way to search through all my stored procs to find a specific string (i.e. xtable in the example above).

Any help provided will be greatly appreciated!

Jordan StradtmanDo you know how to scipt a database?

First off, all sprocs syhould be stored individually in .sql files, preferably in a version control app, or at least on a server...

To do them all script the db and do a search in notepad...|||Notepad?!

What a lame-ass app that is.

PFE32 dude.|||What's a PFE32?|||Programmer's File Editor. Search Google. It's freeware.

Lots and lots of goodies, such as templates, macros, etc. It's basic, small, love it.

Once you use it, you can never go back...|||Here they shoved down our throught this SlickEdit piece of s%$&, and deinstalled my TextPad. Well, thanks for the link, I'll go check it out.|||I should also mention that I have been using PFE for about 6+ years, which might be why I am so attached to it.|||Jordy,

In Enterprise Manager, right-click the database you wish to script, pick "All Tasks", then "Generate SQL Scripts". Click the button "Show All" to list the database objects, the move the objects you wish to script to the right window. There are some check boxes to assist in selecting various groups of object types.

After selecting what you want scripted, click the "Preview" button. When it appears with the scripts for the objects, click the "Copy" button, close up the windows, and paste the scripts into the text editor of your choice.

Stay warm - hope things are going well for you.

-- Greg H., Digital Marketing

No comments:

Post a Comment