What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Sunday, April 23, 2006

I was required to update 40+ tables in our DB; Moran Benisty, our DBA master gave me a cool solution:

SELECT 
   'update ' + name + ' set SomeColumn = ''SomeValue'' where OtherColumn = ''SomeOtherValueToMatchBy'''
FROM 
   sys.objects
WHERE 
   name LIKE 'LK_%'



Now all I had to do is copy the results and run them. Sweet !

BTW - use at your own risk. :)

Posted by Oren Ellenbogen 
23/04/2006 04:42, Israel time UTC+03:00,     Comments [2]  | 
Tuesday, April 25, 2006 8:34:08 PM (Jerusalem Standard Time, UTC+02:00)
I use it quite a bit, this is a great trick.
The bad side of it is when you do it for production, recursively.
Thursday, June 01, 2006 11:42:47 PM (Jerusalem Standard Time, UTC+02:00)
Don't forget sp_MSforeachtable

This helpful little guy "can" sometimes save the whole copy and paste bit:

e.g. EXEC sp_MSforeachtable 'DBCC DBREINDEX (''?'')'
Josh Robb
Comments are closed.