Well, if you happen to be using Sql Server you can do that sort of thing in T-Sql. In Oracle, you can also accomplish the same thing using pl/sql. Either way i'd do it in a stored ...
SQL Server 2008 has a ton of new DBA features, but if you really want to make this thing go, just crank out a little code. SQL Server 2008 is mostly in the domain of system and database administrators ...