This Blog is about MSSQL server 2000/2005 and 2008
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
'
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 '
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 '
3 comments:
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
'
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
'
--Shrink all db log files
exec sp_msforeachdb
'
if ''?'' like ''ces_%''
begin
use [?]
DBCC SHRINKFILE (N''ces_default_Log'' , 0)
end
'
Post a Comment