February 19, 2008 | Comments: (0)
Search and Replace
In writing some code this morning I found it necessary to make some major changes that involved search and replace in SQL Mgmt Studio. I was a little disappointed in the ability of both the SQL tools and Visual Studio to perform rich replace routines.
Here's a simple example of what I was trying to do:
Create View myView
as
Select * from myTable where col1 = 63
I had a couple hundred of these statements in the script and they needed to be changed to:
Create View myView
as
Select * from myTable where col1 < 50
GO
Replacing '= 63' with '< 50' is the easy part.
But try putting that 'GO' statement on the next line between all of them. If there's a way to do it in the tool it's not apparent.
This is why I always keep a version of PrimalScript handy. It has a search/replace util that I haven't seen matched anywhere else. And I wasn't even sure if it would do what I wanted, but it did.
What can I say. I still love this tool. Even though I don't use it for much of my scripting anymore (I just don't do that kind of scripting at my current job), I always have it loaded on my box for emergencies like this.
There are some things I'd like to see PrimalScript's search/replace do, and maybe I'll shoot them a note about some of them. And no, they don't pay me for stuff like this. I actually just love this tool.
Here's a small Camtasia I put together to show you how it works.
SearchReplace.wmv
Posted by Sean McCown on February 19, 2008 10:44 AM
RATE THIS ARTICLE:
-

- COMMENTS
TOP STORIES
HP buys EDS for $13.9 billionCorporate software spending slows
MS targets smartphone market
SOA Software buys LogicLibrary
Phishers scamming IRS rebates
Sun to clarify JavaFX plan
MS' dev tool service packs
Developers' role shifting
MS: SP3 reboots OEMs' fault
Apple: iPhone out of stock
ADDITIONAL RESOURCES

- Application Security: Threats and How to Counter Them
- Why Linux Threats Mean Business
- Virtualization: A Step by Step Approach to Success

- Is your smaller organization ready for High Availability?
- Is system maintenance doing more harm than good?
- Virtual Test Lab Automation: Manage development infrastructure





