use master
go
declare @Databasename varchar(128)
declare @String varchar(1000)
declare Nonsysdatabases cursor for
select [name] from sysdatabases where dbid > 4 order by [name]
open Nonsysdatabases
fetch next from Nonsysdatabases
into @Databasename
while @@fetch_status = 0
begin
set @String = 'ALTER DATABASE [' + @Databasename + '] SET AUTO_SHRINK OFF'
exec (@String)
fetch next from Nonsysdatabases
into @Databasename
end
close Nonsysdatabases
deallocate Nonsysdatabases
go
declare @Databasename varchar(128)
declare @String varchar(1000)
declare Nonsysdatabases cursor for
select [name] from sysdatabases where dbid > 4 order by [name]
open Nonsysdatabases
fetch next from Nonsysdatabases
into @Databasename
while @@fetch_status = 0
begin
set @String = 'ALTER DATABASE [' + @Databasename + '] SET AUTO_SHRINK OFF'
exec (@String)
fetch next from Nonsysdatabases
into @Databasename
end
close Nonsysdatabases
deallocate Nonsysdatabases
Thanks a lot!
ReplyDelete