Wednesday, August 18, 2010

sp_msforeachdb

sp_msforeachdb
'
if ''?'' like ''ces_%''
begin
use [?]
print ''use [''+''?''+'']''
print ''GO''
print ''DROP FULLTEXT INDEX ON lo_text''
print ''go''
end
'

3 comments:

Cognac Critics and Cognac Tasting said...

exec sp_msforeachdb
'
if ''?'' like ''ces_%'' and ''?'' not like ''ces_master%''
begin
use [?]
print ''use [''+''?''+'']''
print ''GO''
print ''DROP FULLTEXT INDEX ON lo_text''
print ''go''
end
'

Cognac Critics and Cognac Tasting said...

exec sp_msforeachdb
'
if ''?'' like ''ces_%'' and ''?'' not like ''ces_master%''
begin
use [?]

if not exists(
select * from INFORMATION_SCHEMA.ROUTINES
where SPECIFIC_NAME = ''pr_sqm_queue_collection'')
begin
print @@servername+''.''+db_name()
end
end
'

Cognac Critics and Cognac Tasting said...

--Shrink all db log files


exec sp_msforeachdb
'
if ''?'' like ''ces_%''
begin
use [?]

DBCC SHRINKFILE (N''ces_default_Log'' , 0)

end
'