home *** CD-ROM | disk | FTP | other *** search
- create proc _mssp_save_dboptions @dbname sysname = NULL as
- set nocount on
-
- if @dbname is null
- begin
- raiserror(14043,-1,-1, '@dbname')
- return (1)
- end
-
- declare @dbid int
-
- select @dbid = dbid from sysdatabases where name = @dbname
-
- if @dbid is null
- begin
- raiserror(15010,-1,-1,@dbname)
- return (1)
- end
-
- declare @allopts int
- select @allopts=number from master.dbo.spt_values where type = 'D' and name = 'ALL SETTABLE OPTIONS'
-
- select '-- db options set ' = 'exec sp_dboption ' + @dbname + ',"' + v.name + '", true'
- from master.dbo.spt_values v, sysdatabases d
- where d.name=@dbname
- and number & @allopts <> 0
- and number not in (-1,@allopts) /* Eliminate non-option entries */
- and v.type = 'D'
- and ((v.number & d.status)=v.number or d.category & (v.number/0x10000) <> 0)
-
- return (0)