set nocount on
declare @cmd varchar(200)
,@cmdstat int
,@count int
,@dbid int
,@dbname varchar(30)
,@total int
select @cmdstat = config_admin(1, 102, 1, 1, NULL, NULL)
select @dbid = 1, @count = 0, @total = 0
while @dbid is not null
begin
select @dbname = db_name(@dbid)
select @cmd = 'select @count = count(1) from '+ @dbname
+ '.dbo.sysobjects'
+ 'where (sysstat2 & 134217728) = 0 '
+ 'and type = ''U'''
exec (@cmd)
if @count > 0
begin
print 'Object count in %1! is %2!', @dbname, @count
select @total = @total + @count
select @cmd = 'update ' + @dbname + '.dbo.sysobjects '
+ 'set sysstat2 = sysstat2 | 134217728 '
+ 'where (sysstat2 & 134217728) = 0 '
+ ' and type = ''U'''
exec (@cmd)
end
select @dbid = min(dbid) from sysdatabases where dbid > @dbid
end
if @total > 0
print 'You must restart ASE for changes to take effect.'
select @cmdstat = config_admin(1, 102, 0, 1, NULL, NULL)