home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70sp3i.exe / X86 / UPGRADE / layout.exe / 1033 / TEXT / 103 < prev   
Encoding:
Text File  |  1999-04-11  |  820 b   |  32 lines

  1. create proc _mssp_save_dboptions @dbname sysname = NULL as
  2. set nocount on
  3.  
  4. if @dbname is null
  5. begin
  6.     raiserror(14043,-1,-1, '@dbname')
  7.     return (1)
  8. end
  9.  
  10. declare @dbid int
  11.  
  12. select @dbid = dbid from sysdatabases where name = @dbname
  13.  
  14. if @dbid is null
  15. begin
  16.     raiserror(15010,-1,-1,@dbname)
  17.     return (1)
  18. end
  19.  
  20. declare @allopts int
  21. select @allopts=number from master.dbo.spt_values where type = 'D' and name = 'ALL SETTABLE OPTIONS'
  22.  
  23. select  '-- db options set ' = 'exec sp_dboption ' + @dbname + ',"' + v.name + '", true'
  24. from     master.dbo.spt_values v, sysdatabases d
  25. where     d.name=@dbname
  26. and     number & @allopts <> 0
  27. and     number not in (-1,@allopts)  /* Eliminate non-option entries */
  28. and     v.type = 'D'
  29. and     ((v.number & d.status)=v.number or d.category & (v.number/0x10000) <> 0)
  30.  
  31. return (0)